简体   繁体   English

基于队列文件的持久性-WebSphere MQ与SQLite队列(WAL)

[英]Queue File based persistence - WebSphere MQ vs SQLite queue (WAL)

I use Websphere MQ and it comes by default with a "file based queue". 我使用Websphere MQ,默认情况下它带有“基于文件的队列”。 So each queue typically has ONE physical file on disk. 因此,每个队列通常在磁盘上只有一个物理文件。

So lets say for this Websphere MQ queue we have multiple readers and writers....I assume there will be some "millisecond locking" overhead between reads and writes, yet I guarantee it will still be quicker than using a full database like DB2 etc. 因此,对于这个Websphere MQ队列,我们​​有多个读取器和写入器。...我假设读取和写入之间会有一些“毫秒级锁定”开销,但是我保证它仍然比使用完整的数据库(如DB2等)更快。 。

Now I have implemented a queue using SQLite and it works in Production happily in WAL mode. 现在,我已经使用SQLite实现了一个队列,它可以在WAL模式下愉快地在Production中工作。

My question is do you really think there is a huge difference in SPEED between the file based queue used by products like WebSphere MQ or the SQLite based queue? 我的问题是,您真的认为诸如WebSphere MQ或基于SQLite的队列之类的产品使用的基于文件的队列之间在SPEED方面存在巨大差异吗? Both are file based after all and the fact that SQLIte is pure ANSI C does it well for speed. 两者毕竟都是基于文件的,而SQLIte是纯ANSI C的事实在速度方面做得很好。

SQLIte does offer some extra functionality like "update hooks" etc....and numerous others. SQLIte确实提供了一些额外的功能,例如“更新挂钩”等...以及许多其他功能。

I guess what I would like to know is if you were going to implement a high speed persistent queue in C would you do it in a similar way to WebSphere MQ and have messages in different offsets etc in a single file, or would you use SQLIte in WAL mode? 我想我想知道的是,如果您要在C中实现高速持久队列,您是否会以与WebSphere MQ类似的方式进行操作,并在单个文件中使用不同偏移量的消息,或者您将使用SQLIte在WAL模式下?

Thanks for the help ;-) 谢谢您的帮助 ;-)

With one message producer, WMQ 7 with default logging parameters (double or triple circular logging) will store about 300-400 persistent message per second on my laptop 7200 hd drive using mqjms api while using as fast jms code as one can realistically expect (one session, one message producer, buffering on channels) and small message size (bytes message with payload size < 1k). 使用一个消息生成器,具有默认日志记录参数(双或三重循环日志记录)的WMQ 7将每秒使用mqjms api在我的笔记本电脑7200 hd驱动器上存储约300-400持久消息,同时使用可实际预期的快速jms代码(一个会话,一个消息生成器,在通道上缓冲)和较小的消息大小(有效载荷大小小于1k的字节消息)。 In this scenario HDD is bottleneck. 在这种情况下,HDD是瓶颈。

You will get get faster speed by using lesser loging on QM side. 通过在QM端使用较少的日志记录,您将获得更快的速度。 This scales pretty linearly. 这相当线性地缩放。 Using unpersistent messages also helps. 使用持久消息也有帮助。

Other common problem is network layer. 其他常见问题是网络层。 Messaging is usually about sending small messages no more than few kb in size. 消息传递通常是关于发送大小不超过kb的小消息。 With common network code (open connection/open session/open producer/and back) from one user you will hit TCP limitations before HDD kicks in. To avoid this problems WMQ allows message batching on channels. 使用一个用户的通用网络代码(打开连接/打开会话/打开生产者/再返回),您将在HDD启动之前遇到TCP限制。为避免此问题,WMQ允许在通道上进行消息批处理。

I doubt that storing persistent messages in WMQ with default loging is faster than inserting blob in a DB2. 我怀疑使用默认日志记录将持久性消息存储在WMQ中比在DB2中插入blob更快。 Underlying mechanism is mostly the same (transactional logs, rec/ack, ...). 底层机制基本相同(事务日志,rec / ack等)。

I never tried to compare it to SQLLite. 我从未尝试将其与SQLLite进行比较。

WMQ is not faster-than-bullet messaging solution. WMQ不是比子弹式消息传递解决方案更快的解决方案。 It is also not the easiest solution to manage. 这也不是最容易管理的解决方案。 Thus said, it has bright sides and by my opinion it is one of better products out there. 因此,它具有光明的一面,我认为它是目前最好的产品之一。

The more constraints you place on the example, the more you would probably be able to make the numbers look like whatever you wanted. 您对示例施加的约束越多,您可能就能使数字看起来像所需的内容越多。 A single queue with one app? 一个应用一个队列? If that's your only requirement then you have lots of choices. 如果这是您的唯一要求,那么您有很多选择。

But take a look at some of the restrictions on WAL mode. 但是,请看一下WAL模式的一些限制。 Checkpoints wait for readers to complete. 检查点等待读者完成。 Therefore more readers you have the harder it is to checkpoint and the more disruptive checkpointing becomes. 因此,读者越多,检查点就越难,检查点的破坏性也就越大。 If the WAL file gets large then read performance degrades so you cannot do lazy checkpointing on a busy system and remain performant. 如果WAL文件变大,则读取性能会降低,因此您无法在繁忙的系统上执行延迟检查点并保持性能。

So the question " if you were going to implement a high speed perstent queue in C would you do it in a similar way to Websphere MQ and have messages in different offsets etc in a single file, or would you use SQLIte in WAL mode? " doesn't capture all the requirements or considerations. 因此,问题“ 如果要在C中实现高速持久队列,您将以与Websphere MQ类似的方式来执行它,并在单个文件中具有不同偏移量的消息,还是在WAL模式下使用SQLIte? ”并未涵盖所有要求或注意事项。 As the number of concurrent users scales, the process architecture begins to overshadow the differences in storage approaches you are asking about. 随着并发用户数量的增加,流程体系结构开始掩盖您所要求的存储方法的差异。 WMQ can handle thousands of concurrent readers and writers, with very large log files with fairly flat performance curves whereas the WAL docs state that performance is proportional to the size of the WAL file, ie performance curves trend down as the WAL gets large. WMQ可以处理数千个并发的读取器和写入器,具有非常平坦的性能曲线的非常大的日志文件,而WAL文档指出性能与WAL文件的大小成正比,即,随着WAL变大,性能曲线呈下降趋势。

If I were going to implement a high speed queue in C? 如果要实现在C高速队列? If you mean which existing product do I pick, I'd go for the one that has had twenty years of tuning and optimization with millions of dollars in R&D invested each of those years and which focuses exclusively on queuing. 如果您是说我选择哪种现有产品,那我将选择经过20年的调优和优化,并在每一年中投入数百万美元的研发资金,并且专门用于排队的产品。 If by "implement" you mean how would I do it if I were to write a new queuing engine from scratch, then I'd be heavily influenced by the products that have focused on queuing for a really long time and try to reuse their solutions to the non-trivial problems. 如果说“实现”是指如果我要从头开始编写新的排队引擎,我将如何做,那么我将受到那些专注于排队很长时间并尝试重用其解决方案的产品的严重影响。非平凡的问题。 Databases and queuing engines didn't arrive at their respective storage architectures by accident. 数据库和排队引擎并非偶然到达其各自的存储体系结构。 One is optimized for queues and one is optimized for database semantics and if you expand your scope to include DBs and queuing engines other than WMQ and SQLite this holds generally true across the categories. 一种是针对队列优化的,另一种是针对数据库语义的优化的,如果您将范围扩展到包括WMQ和SQLite以外的DB和排队引擎,则通常适用于所有类别。

Full disclosure: I've been working with WMQ for most of the twenty years it's been around and recently joined its product management team at IBM. 全面披露:在WMQ成立二十年来,我一直在其中工作,最近加入了IBM的产品管理团队。 I might be a bit biased but I've tried to focus on the technology here and not a knee-jerk "my product is better than your product" reaction. 我可能有一点偏见,但我尝试将重点放在此处的技术上,而不是一时兴起的“我的产品比您的产品更好”的反应。 Feel free to signify agreement with up-votes, disagreement with down-votes. 随意表示同意上赞成票,不同意反对赞成票。 I'll withdraw the answer if it gets too many down-votes. 如果投票过多,我将撤消答复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM