houseofcat / Cookedrabbit
Programming Languages
Projects that are alternatives of or similar to Cookedrabbit
CookedRabbit
.NET 4.7.2
NOTICE! COOKEDRABBIT.CORE (NETCORE) DEVELOPMENT HAS MOVED TO HERE!
https://github.com/houseofcat/RabbitMQ.Core
Performance Updates v1.0.3 -> 1.0.4 on Visual Studio 2019 Enterprise
Click to show!
Program running (v1.0.3).
Profiling...
2019-04-05 05:44:14.754: Creating RabbitChannelPool and RabbitServices...
2019-04-05 05:44:14.925: Creating RabbitChannelPool and RabbitServices finished. Time: 170 ms
2019-04-05 05:44:14.925: Creating test data...
2019-04-05 05:44:15.129: Creating test data finished. Time: 203 ms
2019-04-05 05:44:15.129: Creating and/or Purging benchmark queues...
2019-04-05 05:44:15.224: Creating and/or Purging finished. Time: 94 ms
2019-04-05 05:44:15.224: Publish test starting...
2019-04-05 05:44:23.862: Publish finished. Time: 8637 ms
2019-04-05 05:44:23.862: Publish rate 11578.094 msg/s
2019-04-05 05:44:23.862: Purging benchmark queues...
2019-04-05 05:44:24.061: Purging finished. Time: 198 ms
2019-04-05 05:44:24.061: Shutting down/disposing of services...
2019-04-05 05:44:24.095: Shutting down/disposing of services finished. Time: 33 ms
Program running (v1.0.4).
Profiling...
2019-04-05 19:55:26.275: Creating RabbitChannelPool and RabbitServices...
2019-04-05 19:55:26.412: Creating RabbitChannelPool and RabbitServices finished. Time: 135 ms
2019-04-05 19:55:26.412: Creating test data...
2019-04-05 19:55:26.603: Creating test data finished. Time: 190 ms
2019-04-05 19:55:26.603: Creating and/or Purging benchmark queues...
2019-04-05 19:55:26.622: Creating and/or Purging finished. Time: 18 ms
2019-04-05 19:55:26.622: Publish test starting...
2019-04-05 19:55:27.273: Publish finished. Time: 651 ms
2019-04-05 19:55:27.273: Publish rate 153609.831 msg/s
2019-04-05 19:55:27.274: Purging benchmark queues...
2019-04-05 19:55:27.718: Purging finished. Time: 444 ms
2019-04-05 19:55:27.718: Shutting down/disposing of services...
2019-04-05 19:55:27.754: Shutting down/disposing of services finished. Time: 35 ms
About 1226.7% increase of performance or back in line with previous benchmarks.
Welcome!
About CookedRabbit
CookedRabbit is a simple RabbitMQ wrapper for dealing with channels and connection headaches. It also shows you the natural evolution to common everyday problems with RabbitMQ implementations and how to avoid them. This solution is more orientated to services.
This is RabbitMQ as a Service with lightweight dazzle : RaaS L dazzle
The Demo client begins with examples that you should avoid and slowly progresses to more advanced concepts. The biggest problem I have observed so far is the storing of IModels (RabbitMQ object that represents channels) in containers/collections. This makes code very prone to memory leaks. After observing it countless times, I thought it would make a great candidate for abstraction. The examples are supposed to be simplistic.
This library is not supposed to be rocket science. It should demonstrate simplification, removal, and abstraction of common usage code when wrapping RabbitMQ DotNetClient. It continues to add functionality with simplification at the same time. I recommend getting started with the CookedRabbit wiki examples.
Inspired by the likes of RawRabbit (https://github.com/pardahlman/RawRabbit), I needed a simpler RabbitMQ solution at times for specific situations. The longterm goal is to be modern, lightweight, and KISS. If you need a more thorough/advanced solution, I highly recommend checking out aforementioned RawRabbit or another popular solution: EastyNetQ.
For more details and code examples, visit the Wiki!
Why use CookedRabbit?
Click to show!
I personally would use CookedRabbit because it is simple. Once you are setup with a ChannelPool, you are ready to just Publish and/or Get through a service or RabbitBurrow if you prefer. Obviously it's capable of more but it is entirely optional. One bonus advantage to CookedRabbit is that I will stay current with .Net Framework, NetCore, C#7.x+, and the RabbitMQ client. It is not my intention to let things lag behind Pivotal RabbitMQ or Microsoft releases.
- CookedRabbit is in active development.
- CookedRabbit supports SSL/TLS.
- CookedRabbit supports Gzip, Deflate, and LZ4 compression.
- CookedRabbit supports Utf8Json, ZeroFormat, and JSON string serialization.
- CookedRabbit provides async/await around RabbitMQ calls.
- CookedRabbit is Dependency Injection friendly.
- CookedRabbit services support an optional ILogger from Microsoft.Extensions.Logger.
- CookedRabbit supports logic based customizations.
- CookedRabbit has fairly decent commenting and Wiki being filled out.
- CookedRabbit has a plethora of examples on how to use in the Demo project, Tests project, and Benchmark project.
Last words on this library: it is far from perfect. I am always trying to improve performance but maintain scalability. An overclocker will readily tell you something is always the bottleneck but I tried to blend the software ones as much as possible. Occasionally, you will see something that doesn't quite look like best practices. I am always willing to change and learn - but in some cases, best practices don't work the fastest.
With that being said, here is some sample performance!
Test Setup
i7 8700K @ 4.7 GHz, Samsung Evo Pro 600 512 GB m2 NVMe
100,000 messages (1KB each.) Distributed over 10 queues and a 10 connection/30 channel pool.
RabbitMQ Server v3.7.8 (localhost)
Erlang v21.1
NetCore v2.0.4 / x64 / Release
0 Errors/0 Lost
Summary: Recently added by Pivotal .NET team. Looks like a good performer but believe the library has an unusally long delay getting to the server. The results took an additional second or two to show up server side (validation counts), which means it is probably queued up client side somewhat.
Channel: Uses one channel and some client side buffer.
That means these benchmark numbers are the rate of sending to the client side library queue buffer - not 100% to the actual server.
RabbitMQ 5.10+ - BasicBatch (with async Task Wrapper)
Summary: Not a major performance hit from wrapping in a Task.Run, which is good and allows it to be called asynchronously.
Channel: Uses one channel and some client side buffer.
PublishInParallel - Multi (Concurrent)
Summary: Not designed to be ran concurrently with others as it uses a channel per publish make this heavy on network connectivity between Server and RabbitMQ node. Use this when connection pools are large and network conditions are stellar.
Channel Usage: Psychotic.
Summary: Same as above but only one method is used to publish 100,000 messages. Subject to IConnectionPool overhead.
Channel Usage: 100%.
Summary: Same as above, one method publishes all messages using asynchronous flow.
Channel Usage: Only 1.
Summary: Same as above, one method publishes all messages using synchronous flow.
Channel Usage: Only 1.
Summary: 10 PublishMany single methods fired sequentially.
Channel Usage: Only 1 at a time, new channel at the start of each method.
PublishMany - Multi Async/Concurrent
Summary: 10 PublishMany single methods fired async/concurrently.
Channel Usage: 10 channels engaged at the same time.
Getting Started
Click to show!
Configuring RabbitMQ Server First (if running Local)
To run .Demo locally, have Erlang 20.3 and Server RabbitMQ v3.7.x installed locally and running first.
Use the HTTP API management from RabbitMQ to verify communication is occurring.
The Demo project calls WarmupAsync() will create the queue '001' to work with, if it doesn't exist, and send/receive a test messages.
Developed/Tested Against
- Erlang 20.3 (pre-9/29/2018)
- Erlang 21.1 (post-9/29/2018)
- Erlang 21.3 (post-4/5/2019)
- RabbitMQ Server v3.7.5 (pre-7/6/2018)
- RabbitMQ Server v3.7.7 (pre-9/29/2018)
- RabbitMQ Server v3.7.8 (post-9/29/2018)
- RabbitMQ Server v3.7.14 (post-4/5/2019)
Configuration Values
Checkout the RabbitSeasoning to configure your RabbitService/RabbitTopologyService.
NetFramework Requirements
Click to show!
- Visual Studio 2017+ installed (Community+).
- .NET 4.7.2 SDK installed.
- Compile as C# 7.2+ minimum.
NetCore Requirements
Click to show!
- Visual Studio Code or Visual Studio 2017+ installed.
- Open Folder
NetCore
or open the SLN. - Compile as C# 7.2+ minimum.
- NetCore 2.1.0 SDK installed.
Note: (NetCore runtime 2.1.1 seems buggy at this time)
Documentation
Click to show!
- Visit the Wiki!
- Check out the changelog for detailed changes made via commit.
- Check out the Library Documentation for class/variable/service descriptions and comments.
- Check out the Library Tutorial section for basic how-tos.
Upcoming Features
Click to show!
- Adding a built-in Polly Plugin implementation.
- Custom Connection model with EventListener wireups.
- Disaster recovery & circuit break.
- A ServiceBus-esque client.
- Additional Demonstrations.
Service Topology At A Glance
Click to show ASCII Art!
β
β Your Business Logic
β
β ββ Β» RabbbitBurrow βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β β
β β & RabbitSerializeService : RabbitDeliveryService β
β β & RabbitMaintenanceService : RabbitTopologyService β
β β - Circuit Breaker β
β β - Abstraction β
β β β
β ββββ Β» β ββ Β» RabbitDeliveryService : IRabbitDeliveryService ββββββββββββββββββββ£
β β β β
β β β & RabbitChannelPool β
β β β & RabbitSeasoning β
β β β β
β β β + Flag Channel As Dead β
β β β + Return Channel To Pool (Finished Work) β
β β β β
β β β + Publish β
β β β + PublishMany β
β β β + PublishManyAsBatches β
β β β β
β β β + Get β
β β β + Returns As ValueTuple β
β β β + Returns As AckableResult β
β β β + GetMany β
β β β + Returns As ValueTuple β
β β β + Returns As AckableResult β
β β β β
β β β + CreateConsumerAsync β
β β β + CreateAsyncConsumerAsync β
β β β β
β β β Customize: β
β β β + Use ILogger β
β β β + throw ex β
β β β + Throttling β
β β β β
β β βββ Β» RabbitChannelPool : IRabbitChannelPool ββββββββββββββββββββ£
β β β β
β β β & RabbitConnectionPool β
β β β & RabbitSeasoning β
β β β β
β β β + GetTransientChannel (non-Ackable) β
β β β + GetTransientChannel (Ackable) β
β β β β
β β β + GetChannelPair from &ChannelPool (non-Ackable) β
β β β + GetChannelPair from &ChannelPool (ackable) β
β β β β
β β β Mechanisms: β
β β β + Get Channel Delay (When All Channels Are In Use) β
β β β + In Use ChannelPair Pool β
β β β + In Use Ack ChannelPair Pool β
β β β + Return Channel to A Pool β
β β β β
β β β Customize: β
β β β - Use ILogger β
β β β - throw ex β
β β β β
β β βββ Β» RabbitConnectionPool : IRabbitConnectionPool ββββββ£
β β β β
β β β & RabbitMQ ConnectionFactory β
β β β & RabbitSeasoning β
β β β & ConnectionPool β
β β β β
β β β Customize: β
β β β - Use ILogger β
β β β - throw ex β
β β β - System for Dealing with Flagged Connections β
β β β β
β β βββββββββββββββββββββββββββββββββββββββββββββββββ£
β β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
To be continued on the wiki!
Legend
& Indicates mandatory/crucial internal object.
+ Exists (or exists with future enhancements)
- Does not exist yet.
! Important