views:

61

answers:

5

The place where I work has 2 servers and a load balancer. The setup is horrible since I have to manually make sure both servers have the same files. I know there are ways to automate this but it has not been implemented, hopefully soon (I have no control over this). I wrote an application that collects a bunch of information from a user, then creates a folder named after the email of the user in one of the servers. The problem is that I can't control in which server the folder gets created in, so let say a user goes in.. fills his stuff and his folder gets created in server 1, user goes away for a while and goes back to the site but this time the load balancer throws the user into server 2, now the user does something that needs to be saved into his folder but since it didn't created in this server an error occurs. What can I do about this? any suggestions?

Thanks

A: 

It sounds like you may be having a session state issue. It sounds odd the way you describe it, but have a look at this article. It's old, but covers the basics. If it doesn't try googling "asp.net session state web farm"

http://ondotnet.com/pub/a/dotnet/2003/03/24/sessionstate.html

Jim Leonardo
+2  A: 

It sounds like you could solve a few issues by implementing a cloud file service for the file writes such as Amazon S3 http://aws.amazon.com/s3/

  1. Disk size management would no longer be a concern
  2. Files are now written and read from S3 so load balancer concerns are solved
  3. Benefits of a semi-edge network with AWS. (not truly edge but in my experience better than most internally hosted solutions)
jamessqr
If you can afford it this would probably be the best solution for database file storage (as opposed to going into a MSSQL or MySQL db on your servers). You'll get awesome performance from Amazon.
cottsak
Depends on the scale, and a bunch of factors. Suspect this will be small enough to handle using a local database. And there's far less architecture to be done than connecting to the internet for your data.
SamStephens
+2  A: 

Don't store your data in the file system, store it in a database.

If you really can't avoid using the file system, you could look at storing the files in a network share both servers have access to. This would be a terrible hack, however.

SamStephens
is actually PDF files that get created and goes into the user folder. Can I store these files in a database efficiently?
Migs
Depends on the size. But in general, absolutely. I've been involved in an organisation that stores gigabytes of PDFs in a database. Just make sure you do your homework as to the options your database gives you, and make sure you know the performance you need from the database, and performance test it before you start the website coding required.
SamStephens
great thanks for the helps. I'm new to this site so I'm not sure how to thank everyone that chipped in but thanks everyone!
Migs
Mark someone as having answered the question, this will grant them reputation.
SamStephens
A: 

This is a normal infrastructure setup. Below are the two commonly used solutions for the situation you are in.

  1. If you have network attached storage available (e.g. Netapps), you can use this storage to central store all of your user files that need to be available across all servers in your web farm.
  2. Redesign your application to store all user specific data in a database.
Mike Ritacco
A: 

It seems like no one has suggested this, soooo -- why not just have your code write the files to both servers during your save operation? It may not be the most optimal solution, but it's quick, dirty and cheap.

o6tech