Source code with Gatling tests here (WIP): https://github.com/turingg/file-server
I wanted to compare the performance/throughput of an async file upload servlet to a sync version. To do that, I intentionally configured Tomcat to: * Use at most 2 HTTP connector threads * Accept up to 1000 connections * With a queue length of 0 <Connector port="8080" protocol="HTTP/1.1" asyncTimeout="30000" connectionTimeout="30000" acceptCount="0" maxConnections="1000" maxThreads="2" minSpareThreads="2" processorCache="1" redirectPort="8443" /> However despite that, my async servlet ( https://github.com/turingg/file-server/blob/master/src/main/java/xyz/behrang/fileserver/b/AsyncUploadServlet.java) has 33% less throughput compared to the sync version (( https://github.com/turingg/file-server/blob/master/src/main/java/xyz/behrang/fileserver/a/SyncUploadServlet.java ): # Async ---- Global Information -------------------------------------------------------- > request count 5000 (OK=5000 KO=0 ) > min response time 218 (OK=218 KO=- ) > max response time 2234 (OK=2234 KO=- ) > mean response time 674 (OK=674 KO=- ) > std deviation 486 (OK=486 KO=- ) > response time 50th percentile 464 (OK=464 KO=- ) > response time 75th percentile 773 (OK=772 KO=- ) > response time 95th percentile 1890 (OK=1891 KO=- ) > response time 99th percentile 2142 (OK=2142 KO=- ) *> mean requests/sec 555.556 (OK=555.556 KO=- )* ---- Response Time Distribution ------------------------------------------------ > t < 800 ms 3780 ( 76%) > 800 ms < t < 1200 ms 525 ( 11%) > t > 1200 ms 695 ( 14%) > failed 0 ( 0%) ================================================================================ # Sync ================================================================================ ---- Global Information -------------------------------------------------------- > request count 5000 (OK=5000 KO=0 ) > min response time 1 (OK=1 KO=- ) > max response time 1617 (OK=1617 KO=- ) > mean response time 207 (OK=207 KO=- ) > std deviation 333 (OK=333 KO=- ) > response time 50th percentile 36 (OK=36 KO=- ) > response time 75th percentile 150 (OK=150 KO=- ) > response time 95th percentile 992 (OK=992 KO=- ) > response time 99th percentile 1312 (OK=1312 KO=- ) *> mean requests/sec 833.333 (OK=833.333 KO=- )* ---- Response Time Distribution ------------------------------------------------ > t < 800 ms 4458 ( 89%) > 800 ms < t < 1200 ms 479 ( 10%) > t > 1200 ms 63 ( 1%) > failed 0 ( 0%) ================================================================================ Any ideas what am I missing here? Thanks in advance, Behrang