This is a small test/benchmark to se if the use of a unix domain socket in Nginx would affect performance in any significant way for an api
The api is hosted by .NET Core and containerized. Test is done by using apache benchmark. doing 100 concurrent request 50 times. The request that is done has a payload of 1,7 KB.
ab -n 5000 -c 100 "http://localhost/v3/api/"
Result
This is the average request per second after 10 tests against each configuration.
Requests per second | |
HTTP | 100 |
HTTP (Keepalive enabled) | 118 |
Unix Socket | 98 |
Unix Socket (Keepalive enabled) | 120 |
Keepalive
Nginx option keepalive has an impact on both http and unix sockets. It looks to be far more important than the actual connection type.
upstream backend {
keepalive 100;
server 10.265.44.3:8080;
}