Reputation: 1133
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.
Upvotes: 1
Views: 486
Reputation: 176
I can see two options close to Geoffrey answer.
1. Upload images to an upload directory syncronized through rsync.
Then the # of images would be much smaller and they would sync much faster.
After you go through the whole process you can move the image to the right folder.
2. DB: Storing not the image itself but the url of the image, so you always will know which server is holding it, having access to it.
Just two options that came reading Geogrey's answer and looking for info related to this topic.
Upvotes: 0
Reputation: 11364
There are a few solutions to this.
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.
Upvotes: 1