doutao5499 2011-05-21 23:20
浏览 73


We have two apache/php web servers load balanced with squid page caching proxy. The squid caching is not active on image submission pages. We have a form where users can submit images.

It's a two step process. They first upload the images. The second step they can enter details about the images and images are then moved over to correct folders once they submit the image details.

Problem is when there is high traffic the second step might be served from a different server then the one with the uploaded images. So the second step might not find the uploaded images and upload fails to complete.

We have thousands of image files on these servers so the syncing between them is slow. Is there anyway that we can force a specific page to always to be served from a specific server? Basically to bypass the load balancing feature.

  • 写回答

2条回答 默认 最新

  • doumanshan6314 2011-05-28 10:19

    There are a few solutions to this.

    1. Switch to nginx as a reverse proxy and you can stick clients to the host
    2. Make the upload directory a NFS share mounted on both hosts
    3. Upload the file into a mysql table (probarbly best to use a hash table) so both servers can access it.

    Personally I would go with option 1 as you still get round robin load balancing, but each connection is stuck to the host that it was initially connected to.

    Option 2 has the benefit of still equally balancing requests, but the downside is the NFS share is a single point of failure.

    Option 3 can cause issues if there is not enough ram on the DB server if you use a hash table.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上