开发者

file uploads and sessions while load balancing using nginx and php5-fpm

开发者 https://www.devze.com 2023-04-05 15:28 出处:网络
We have two webservers running with nginx + php5-fpm configuration (native php sessions on a memdisk)

We have two webservers running with nginx + php5-fpm configuration (native php sessions on a memdisk)

The webservers are using different subdomains and load-balancing is somehow satisfied. Now we want to use the same domain address for these servers and even newer ones with the exact same configuration.

Installing an nginx in front of these web servers does not sound as a good idea since there are many file uploads to these web servers and the datatraffic passing through the loadbalancer for each upload would cause unnecessary traffic. Round robin DNS solution needs sessions shared in memcache, redis or db. This is开发者_运维技巧 also what we do not like because we keep too much data in sessions and very fine with it in our memdisks on local.

Are there any other configurations that fit to our needs?


The data will need to go through some networking appliance or other. This can be an application loadbalancer like Nginx, a software network loadbalancer like LVS, a hardware loadbalancer or, if DNS roundrobin is used, you still need to route the traffic through a switch.

If you are not satisfied with the performance of Nginx, check out LVS or consider buying a hardware loadbalancer. We saw really good performance through LVS (Linux Virtual Server) at the webhosting company where I used to work, so there's still much you can do with software.

Do some research. Set up an Nginx or LVS loadbalancer and benchmark it. Imitate your usual traffic patterns and check how it performs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号