[sr-dev] Proxy caching patch

marius zbihlei marius.zbihlei at 1and1.ro
Tue Jan 26 17:18:47 CET 2010


Hello,

I have worked lately on the patch that tries to mitigate one performance 
problem in core:action.c file. I am talking about the multiple
calls to mk_proxy(), and the creation of temporary proxies for each 
FORWARD_T action that the daemon executes.

I think this behaviour can be improved by caching certain proxies. My 
idea is this:

 * If the  next_hop  matches a name in the alias list (for example we 
have an alias for example.com and the next_hop is proxy1.example.com), 
then cache the proxy by calling add_proxy instead of mk_proxy. If the 
proxy is already cached a pointer is returned, if not it is created and 
added (the functionality already exists in proxy.c)
 * For all other hosts a temporary proxy is made(same as now).

This whole logic can be turned off(default)/on by a parameter in .cfg.

I have run some tests and this can lead to big improvemets (because 
mk_proxy mean some pkg_malloc - fast but also some DNS resolving - 
slow). This might benefit some medium-large setups where you have some 
servers forwarding request to other application servers, etc.

The patch is very small and it's already done and finished. I will 
provide it tomorrow if somebody thinks this idea is good

Cheers

Marius





More information about the sr-dev mailing list