将通过 HTTP 接收到的数据更快地存储到数据库(或文件系统)中
我需要非常快速地存储通过 HTTP 收集的二进制数据。
我有一个客户端通过 HTTP 向服务器发送数据,服务器将数据存储到数据库表中。成分:Java 1.5、Tomcat 5.5、Hibernate 3.0、SQL Server、jTDS JDBC 驱动程序。
我不想让客户等待,所以我分离了任何业务逻辑,只是将内容排队以供稍后处理。
如何让数据存储更加高效?
我是否可以获得一些时间:
- 使用不同的版本(例如“使用 tomcat 6”或“使用 Java 7”)?
- 更改配置(例如“在 Tomcat 中禁用调试模式”或“使用 -Dblazingfast”Java 选项)?
- 交换组件(即“使用 JBoss,而不是 Tomcat”)?
- 使用不同的编程技术(例如“使用 while 循环而不是 for 循环”)
我应该使用缓存作为 ehcache 吗?我应该放弃 Hibernate 并使用 JDBC 吗?是否有足够可配置的东西可以用来代替我的自定义 servlet?
预先感谢,任何提示表示赞赏。
I need to store binary data gathered via HTTP very fast.
I have a client sending data via HTTP to a server that stores the stuff into a database table. Ingredients: Java 1.5, Tomcat 5.5, Hibernate 3.0, SQL Server, jTDS JDBC drivers.
I do not want the clients to wait, so I'm detaching any business logic and just queuing up the stuff for later processing.
How can I make the data storing more efficient?
Do I gain some time:
- using different versions (es. "use tomcat 6" or "use Java 7")?
- changing configurations (es. "disable debug mode in Tomcat" or "use the -Dblazingfast" Java option)?
- swapping components (es "use JBoss, not Tomcat")?
- using different programming tecniques (es. "use while loops instead of for loops")
Shall I use a cache as ehcache? Shall I ditch Hibernate and use JDBC? Is there anything configurable enough that I can use instead of my custom servlet?
Thanks in advance, any hint appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果写入磁盘没问题,那么您可以按照此处的建议进行操作。顺便说一句,我本能地认为字节数组应该比
String
处理得更快。If writing to disk is OK then you could do as suggested here. On a side note, instinctively I think byte array should be faster to handle than a
String
.