[patch] only stat dns_cache_hosts file once in a second
Hi, I was doing today some performance tests where use_dns(yes) and persistent dns cache (dns_cache_hosts) were configured and I got awful results. When I disabled dns_cache_hosts the message rate doubled. After a quick check I realized that for every message a dns cache lookup was performed which stat()-ed my dns_cache_hosts file. However it does not make much sense to check the file for modification so often, I guess once a second is enough most of the cases. In my test configuration I received msgs over syslog() source and sent to an empty destination. The server was a 2way quad-core 1.9GHz Opteron box running 32bit syslog-ng and messsages were generated with loggen.
From an average 80,000-90,000 msg/s using the fix I could do 220,000-230,000 msg/s. Interesting that on my laptop (dual-core 2.4GHz Intel 64bit) the performance gain was smaller from 90,000 to 100,000 msg/s. I am still wondering about this big difference, specially because my laptop has higher frequency CPU...
Anyhow the patch could be found in my git repo, Bazsi please apply. git://git.balabit.hu/marci/syslog-ng-3.0.git M -- Key fingerprint = F78C 25CA 5F88 6FAF EA21 779D 3279 9F9E 1155 670D
On Wed, 2009-02-25 at 23:32 +0100, ILLES, Marton wrote:
Hi,
I was doing today some performance tests where use_dns(yes) and persistent dns cache (dns_cache_hosts) were configured and I got awful results. When I disabled dns_cache_hosts the message rate doubled. After a quick check I realized that for every message a dns cache lookup was performed which stat()-ed my dns_cache_hosts file. However it does not make much sense to check the file for modification so often, I guess once a second is enough most of the cases.
In my test configuration I received msgs over syslog() source and sent to an empty destination. The server was a 2way quad-core 1.9GHz Opteron box running 32bit syslog-ng and messsages were generated with loggen.
From an average 80,000-90,000 msg/s using the fix I could do 220,000-230,000 msg/s. Interesting that on my laptop (dual-core 2.4GHz Intel 64bit) the performance gain was smaller from 90,000 to 100,000 msg/s. I am still wondering about this big difference, specially because my laptop has higher frequency CPU...
Anyhow the patch could be found in my git repo, Bazsi please apply. git://git.balabit.hu/marci/syslog-ng-3.0.git
Integrated as commit 731a28515dffa4f5de09fd1de3b3c7b262fc6093 Author: ILLES, Marton <marci@balabit.hu> Date: Wed Feb 25 22:56:10 2009 +0100 only stat dns_cache_hosts file once in a second and not at each lookup On my dual-core 2.4GHz x86_64 laptop it yields 10% while on an 2way quad-core 1.9GHz x86 Opteron server it yileds 100% gain Thanks. -- Bazsi
participants (2)
-
Balazs Scheidler
-
ILLES, Marton