大规模图片存取的高性能解决方案

09-03-12 licfc
最近开始做一个j2ee网站,主要是大用户量的图片访问和上传,用spring和ibatis开源框架搭建,http服务器用apache服务器,应用服务器用jboss,数据库采用oracle10g.

其中碰到了几个技术难点,希望大家能给于意见和建议:

1,图片这种资源是存储在文件系统中好,还是存储在oracle数据库中好?以性能优先考虑,但不考虑集群。

2,提高图片存储效率有什么好的方案?

3,还有采用缓存策略,哪些数据该被缓存?

谢谢

saharabear
2009-03-12 17:40
>>最近开始做一个j2ee网站,主要是大用户量的图片访问和上传,用Spring和ibatis开源框架搭建,http服务器用apache服务器,应用服务器用jboss,数据库采用oracle10g.

>>其中碰到了几个技术难点,希望大家能给于意见和建议:

>>1,图片这种资源是存储在文件系统中好,还是存储在oracle数据库中好?以性能优先考虑,但不考虑集群。

I believe that never store no-relation data(including nearly all binary data) in relation database. So, supply a path is best.

>>2,提高图片存储效率有什么好的方案?

it's about the I/O condition. I do not know anything about your solution of storage. If it is possible, use NFS is a good choice.

>>3,还有采用缓存策略,哪些数据该被缓存?

What do you want to cache? Data, binary data? or object? or database cache?

If you just want to cache the pictures, I suggest you to try squid.

Apache with jboss is a good idea but maybe you should try NIO mode. If you just need to supply service for picture, ngnix is the second choice against apache.

ps: if you just need spring, maybe you just need a servlet container. jboss web is enough for you.

licfc
2009-03-12 18:05
谢谢saharabear.

实际上,我们这个项目是公司的一种尝试,因为以前从来没做过这一块,所以这次专门由我们项目组来做一次探索,最主要的目标就是探求大规模图片存取时如何取得比较好的性能,也就是以性能优先。

最后您说的cache些什么?我意思是在这种以图片存取为主要功能的网站中,能否用cache取得些在性能上的突破,至于cache什么,您说直接cache图片是否能达到这种目的?

谢谢

saharabear
2009-03-12 19:05
>>最后您说的cache些什么?我意思是在这种以图片存取为主要功能的网站中,能否用cache取得些在性能上的突破,至于cache什么,您说直接cache图片是否能达到这种目的?

you must find the bottleneck. I believe you will met two side: one is I/O for picture service. the next is the database.

so, cache most pictures in squid, and use data cache to resolve the DB bottleneck.

as I said, ngnix is the alternative for static files against Apache.

squid(Here, cache your pictures)

|

|

Ngnix/Apache

|

|

JBoss Web/Container(Here, cache your data and object)

|

|

DB

|

|

NFS Storage(you should try ZFS on solaris 10, even on x86 platform)

licfc
2009-03-12 21:28
Thank you! I will try:)

猜你喜欢