开发者

Image Upload directly from client to remote server? Spring/Tomcat

Just wondering what the common solution is for this. We have two web servers that are load balanced and a separate server that holds our images. Our current process is that a user uploads an image directly to the web server (which ever they are connected to) and we enter a job into our DB. Another process checks for image jobs every few mins and copies the image from the web server up to the image server.

The delay from when a user uploads to when its visible is not ideal. We could tighten the loop on how often we check for image jobs but ideally I would like to have user uploaded images to go directly 开发者_运维技巧to the image server rather than copying twice. How should this be done? Is there anything in spring to deal with this ? Seems like how most would deal with a CDN i would think?

I want to limit the time it takes for an image that a user uploads is available on our site...


Just give the webapp direct access to the imageserver so that it can instantly save the image on the image server. I don't see how that forms a problem.


You could insert the image on upload into your db. When the image is requested and it is not in the filesystem, you then can deliver it from db and at the same time sync it to the filesystem. If you don't want to hold all images in the db, you then could also delete it from there in the same step.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜