apernet / hysteria

Hysteria is a powerful, lightning fast and censorship resistant proxy.
https://v2.hysteria.network/
MIT License
14.67k stars 1.64k forks source link

[Help me] Packet drops, near zero upload speed, poor performance in Iran #532

Open Azadzadeh opened 1 year ago

Azadzadeh commented 1 year ago

Details

I've set up Hysteria on a server and I'm using its client on Linux (Iran). No scripts is used for hysteria in this setup and I'm using the binaries (amd64-avx) directly with manually written config files.

Hysteria performs worse than X-ray + VLESS + TCP + TLS (or even VLESS without TLS, over WebSocket). Meaning it consistently has less download and upload speed than the mentioned x-ray method. Here are some Speedtest stats showing the situation:

Iran (without any proxies):

iran

X-ray + VLESS + TCP + TLS:

(It usually has better upload speed than this) xray

Hysteria (passing speedtest):

hysteria

Hysteria (failing speedtest):

(It freezes here and test stops) hysteria-bad

I have done the socat test to check whether the UDP connection is completely blocked or not (https://github.com/apernet/hysteria/issues/518). The test succeeded (I saw what I typed locally on remote). Meaning the UDP connection is not completely blocked (as of now).

Note that on server, I'm using a script for x-ui setup + Cloudflare WARP to bypass Google ReCaptcha.

Hysteria server information

hysteria version v1.3.2 2022-12-11 02:15:05 dd4c17972fdfef7517c22d017ec922463fb94350

VPS information

OS: Ubuntu 22.04.1 LTS x86_64 Kernel: 5.15.0-56-generic

Server config

{
  "listen": ":36712",
  "protocol": "udp",
  "cert": "....../fullchain.pem",
  "key": "....../privkey.pem",
  "obfs": "mypassword",
  "up_mbps": 4,
  "down_mbps": 8,
  "resolver": "udp://1.1.1.1:53",
  "resolve_preference": "64"
}

Hysteria client information

hysteria version v1.3.2 2022-12-11 02:15:05 dd4c17972fdfef7517c22d017ec922463fb94350

Client config

{
    "server": "my.domain.name:36712",
    "protocol": "udp",
    "obfs": "mypassword",
    "up_mbps": 4,
    "down_mbps": 8,
    "resolver": "udp://1.1.1.1:53",
    "resolve_preference": "64",
    "socks5": {
        "listen": "127.0.0.1:1080"
    },
    "http": {
        "listen": "127.0.0.1:1089"
    }
}

Client environment (operating system)

Ubuntu

tobyxdd commented 1 year ago

Did you use socat to test on the same port Hysteria was using, preferably right after your connection is dropped? Your ISP might be intermittently blocking UDP like some Chinese ISPs do. Maybe https://hysteria.network/docs/port-hopping/ could help.

btw you misunderstood up_mbps & down_mbps. Server's upload is your client's download. You have "up_mbps": 4 on your server so no wonder your download speed can't go beyond 4 Mbps. Usually you don't even need to set those on your private servers - they are for public servers to prevent abuse.

Azadzadeh commented 1 year ago

Did you use socat to test on the same port Hysteria was using,

Yes

preferably right after your connection is dropped?

It's hard to catch. The disconnects happen randomly. I just tried again after a failure. socat still works.

Your ISP might be intermittently blocking UDP like some Chinese ISPs do.

As a matter of fact, they did block UDP completely a couple of weeks ago but unblocked it recently. So hysteria can't work in situations that UDP is completely blocked? Even the "faketcp" mode?

I haven't tried the hopping method yet since from the looks of it, the packet-drops on a specific UDP connection happen more quickly than a 10 seconds window. Like, I guess I should choose a 3 seconds window for hopping.

liuxyon commented 1 year ago

you may use our server for test your network. tg group chat.

Azadzadeh commented 1 year ago

@liuxyon @tobyxdd Is there a systematic and reproducible way in commandline to test the quality of a connection over a SOCKS port? This way we could have a sense on what parameters to tweak in server/client on a particular network for optimal performance.

TheMockinJay commented 1 year ago

I second this

@liuxyon @tobyxdd Is there a systematic and reproducible way in commandline to test the quality of a connection over a SOCKS port? This way we could have a sense on what parameters to tweak in server/client on a particular network for optimal performance.

tobyxdd commented 1 year ago

@liuxyon @tobyxdd Is there a systematic and reproducible way in commandline to test the quality of a connection over a SOCKS port? This way we could have a sense on what parameters to tweak in server/client on a particular network for optimal performance.

I typically use iperf3 for testing and have a private branch that includes additional debug statistics. It would indeed be useful to have built-in tools for benchmarking and tuning. I will see if we can incorporate these features.

shakibamoshiri commented 6 months ago

As I tested Hy2 is the fastest one so far -- the uplaod=0 in Iran is because of Iran FWs throttling that protocol Also the speedtest cannot be a good metric for speed-test , the iperf3 is better