Enquiry regarding Sticky Module's hash functions

Jérôme Loyet jerome at loyet.net
Thu Oct 6 16:39:00 UTC 2011

2011/10/6 ramindeja <nginx-forum at nginx.us>
> Hi,


> We are using NGINX as a load-balancer and we would like to learn more
> about the MD5 hash function. We need to replicate this function in our
> Java application.
> We are using the sticky module that hashes the IP.

Are you talking of this module: http://code.google.com/p/nginx-sticky-module/ ?

> When we tried to hash
> the same IP:PORT using MD5 in Java , we never got the same result. What
> inputs should we use for the MD5 function.

If you are using nginx-sticky-module, you won't be able to recreate
the same MD5 easily because the module uses internal nginx data to
create the hash.
You can look in ngx_http_sticky_module.c on line 146
You'll find out that the md5 hash is made from the sockaddr internal
structure which discribe each backend server and I'm not sure you'll
be able to reconstruct the very same structure on your java side.

what is your need ? there is maybe another way to achieve your goal.

++ jerome

> Thanks in advance,
> RaminDeja
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,207455,216324#msg-216324
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

More information about the nginx mailing list