HI, here is problem to access image or other files. Umbraco store
image inside /Media/XXXX/ filename.ext. Lets say we have 3 server and
One Database running. Each server sharing same database, Means database is
same for 3 server.
Condition: Editor(1) upload image to Server1
after 10 minutes, Server(1) gets CPU usage 100%. In that case Mechanism
will switch to Server(2)
now lets say Editor(1) upload image which will be stored in
Server(2). after 10 minutes server(2) also gets CPU usage 100%, in that
case Mechanism will switch to Server(3).
User request websites. In
that case server(3) will serve website for users. but two images that
are stored in Server(1) and (Server(2) will not be available to user
because umbraco store those image in server(1) and server(2) hard disk
or in Server(1).......C:/.......... /Media/XXXX/ image1.jpg which is not access by server(3).
To solve this problem one idea is to store image in database so that all server can retrive image.
How can i store image in database instead of /Media/XXXX/ filename.ext directory?
If you really want this you have to write your own Datatypes for this. But I think it's better to let the web farm handle this by replication. All my customers having a webfarm are working with media this way..You scenario is also not correct, what will happen when the database server gets 100% CPU?
Instead of storing the media in a database I would definitely have a look at using an attached file storage of some kind, which is then available to all servers. That means there is only 1 place where media gets saved to. If the NAS is hooked up via a fast network that should work perfectly well (you could also use the server with the db for that).
Another solution is to to use some kind of file synchronization, the server with the backend would then preferably be the master system with the master system either pushing out changes in real time or the slaves will listen for changes themselves.
If you want to go down the database route you would probably need to do at least these 2 things:
- create a new upload control that looks pretty much like the existing one but saves the image as blob to the database (be sure to use locks/sql transaction/etc)
- create some kind of retrieval mechanism; the biggest issue here is that you don't actually have a file and therefore no url for the images, so some kind of caching mechanism would be a good idea. But then again that sounds suspiciously like file synchronization...
I’m trying configure multiple servers to use a single media folder.The issue I have is that Courier is always copying media to the ~/media folder.I have tried using the umbracoMediaPath setting and replacing the /media folder with a virtual directory pointing to my NAS folder but Courier always creates a new media folder on the root.Any ideas, I’ve been trying for 2 solid days?
to solve my problem, i create custom user control that upload image in database, and i use userconrol wrapper to use userconrol as datatype. it solved my problem.
.. i upload image in database and, retrive id of that image, and i set that umbracoValue = id,
next time i use id to retrive image from database. in my case there is not that much images so that it will not problem in performance, but i donøt know about your case. if you need to store huge image file, my idea will not be good idea.
Storing Image in Database
HI, here is problem to access image or other files. Umbraco store image inside /Media/XXXX/ filename.ext. Lets say we have 3 server and One Database running. Each server sharing same database, Means database is same for 3 server.
Condition: Editor(1) upload image to Server1 after 10 minutes, Server(1) gets CPU usage 100%. In that case Mechanism will switch to Server(2)
now lets say Editor(1) upload image which will be stored in Server(2). after 10 minutes server(2) also gets CPU usage 100%, in that case Mechanism will switch to Server(3).
User request websites. In that case server(3) will serve website for users. but two images that are stored in Server(1) and (Server(2) will not be available to user because umbraco store those image in server(1) and server(2) hard disk or in Server(1).......C:/.......... /Media/XXXX/ image1.jpg which is not access by server(3).
To solve this problem one idea is to store image in database so that all server can retrive image.
How can i store image in database instead of /Media/XXXX/ filename.ext directory?
Thanks in advanced
HI,
If you really want this you have to write your own Datatypes for this. But I think it's better to let the web farm handle this by replication. All my customers having a webfarm are working with media this way..You scenario is also not correct, what will happen when the database server gets 100% CPU?
Cheers,
Richard
Hi jeevan,
+1 for Richard's answer.
Instead of storing the media in a database I would definitely have a look at using an attached file storage of some kind, which is then available to all servers. That means there is only 1 place where media gets saved to. If the NAS is hooked up via a fast network that should work perfectly well (you could also use the server with the db for that).
Another solution is to to use some kind of file synchronization, the server with the backend would then preferably be the master system with the master system either pushing out changes in real time or the slaves will listen for changes themselves.
If you want to go down the database route you would probably need to do at least these 2 things:
- create a new upload control that looks pretty much like the existing one but saves the image as blob to the database (be sure to use locks/sql transaction/etc)
- create some kind of retrieval mechanism; the biggest issue here is that you don't actually have a file and therefore no url for the images, so some kind of caching mechanism would be a good idea. But then again that sounds suspiciously like file synchronization...
Anyway, hope that helps,
Sascha
Hi,
I’m trying configure multiple servers to use a single media folder. The issue I have is that Courier is always copying media to the ~/media folder. I have tried using the umbracoMediaPath setting and replacing the /media folder with a virtual directory pointing to my NAS folder but Courier always creates a new media folder on the root. Any ideas, I’ve been trying for 2 solid days?
Thanks
Jason
to solve my problem, i create custom user control that upload image in database, and i use userconrol wrapper to use userconrol as datatype. it solved my problem.
.. i upload image in database and, retrive id of that image, and i set that umbracoValue = id,
next time i use id to retrive image from database. in my case there is not that much images so that it will not problem in performance, but i donøt know about your case. if you need to store huge image file, my idea will not be good idea.
right now i donot have any idea in your case.
is working on a reply...