-
Notifications
You must be signed in to change notification settings - Fork 53
Performance test: select() vs poll()
Determine the performance difference between two file descriptors monitoring methods: select() vs poll().
Machine: AWS EC2 t2.micro (1 vCPU ‒ Intel Xeon, 1 GB RAM), Amazon Linux AMI 2018.03
Silgy version: 4.1
There were two Silgy apps:
- Server: Silgy Hello World as it was (with default FD_MON_POLL), and with FD_MON_SELECT set, started by
ec2-user
- Client: perf with 10
silgy_svc
processes, started byroot
There were 2 tests, both with freshly started server:
-
FD_MON_POLL version queried by 100 batches @ 1000 requests each, 3 series
-
FD_MON_SELECT version queried by 100 batches @ 1000 requests each, 3 series
-
FD_MON_POLL
-
from the client's point of view:
Average = 0.19 ms
24161 per second
19196 per second
19987 per second -
server's point of view:
-------------------------------------------------- Memory: 4 760 kB (4.65 MB / 0.00 GB) -------------------------------------------------- req: 300000 average: 0.100 ms connections HWM: 10
-
-
FD_MON_SELECT
-
from the client's point of view:
Average = 0.19 ms
17441 per second
18956 per second
18166 per second -
server's point of view:
-------------------------------------------------- Memory: 4 804 kB (4.69 MB / 0.00 GB) -------------------------------------------------- req: 300000 average: average: 0.124 ms connections HWM: 10
-
As expected, poll() allows slightly better performance, as it does not require building FD_SET, nor resetting timeout before each call, as select() does. The difference however is not a huge one, below 10%.