Building a high performance and automatically backupped queue

时间秒杀一切 提交于 2019-12-11 17:12:47

问题


Please give me some hints on my issue.

I'm building a queue data structure that:

  1. has a backup on hard disk at realtime
  2. and can restore the backup
  3. Can respond to massive enqueue/dequeue request

Thank you!


回答1:


Is this an exercise your doing. If not, you should probably look at some of the production message queueing technologies (e.g. MSMQ for Windows) which supports persisting the queues on the disk and not just storing them in memory.

In terms of your requirements

1. has a backup on hard disk at realtime

Yes MSMQs can do that.

2. and can restore the backup

And that.

3. Can respond to massive enqueue/dequeue request

And this...




回答2:


If you can avoid it, don't roll your own. For Java try ActiveMQ.




回答3:


You're probably looking at something more complex than just a simple library.

Since this is an exercise (probably wanting you to think about the underlying data structures), you might start the simple way by queueing to a mySQL database. Your performance will suck compared to dedicated queueing software, but you can at least get the rest of the infrastructure working.

After that, you'll probably be looking at some form of custom file format and a multi-threaded server on top of it. You might be able to pull it off using something like BDB or SQLite for the I/O layer, thus saving you the trouble of writing the actual disk routines.



来源:https://stackoverflow.com/questions/798748/building-a-high-performance-and-automatically-backupped-queue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!