Why we need Pipeline mode - Trojan-Plus-Group/trojan-plus GitHub Wiki

The simple answer for the question of title, is latency.

Trojan want to visit its server, it has to establish a TCP connect + TLS handshake, even though using fase_open or SSL reuse, it has higher latency than other proxy software. Follow is example:

I test simplest a single UDP query, dig DNS in linux:

or via a TCP DNS:

of course my proxy server pings is about 180ms, so near 350ms was used for TCP and TLS establishing.

Image that if your visit a website, many TCP connections will be establish and drop, every single one spended more than 300ms for proxy, it might be terriable, but good news is that most of web bowser use cocurrency to create TCP, so we won't feel slower than those visitings without proxy.

As I know, most Google Android apps, such as Play Store, Youtube, Photos, would use UDP for prority (it will switch to TCP if UDP failed), so if every single UDP connection has to spend more time... em, cocurrency connection should rescure high latency again.

Pipeline mode is my thought to optimize this problem seems not worth mentioning. After using pipeline, the latency will be reduced from 500ms to 190ms, close to ping value:

It's faster than ss (pure encryption TCP) !!

(above image is ss udp query)

Pretty cool, ha! Actually this 'pipeline' concept might be known as "multiplexing", many proxy connections try to use one single established TCP.

How to realize, please check my tech design brief wiki.