-
Notifications
You must be signed in to change notification settings - Fork 167
Feature: NATS Backplane #486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Reducing allocations for backplane messages Make Backplane Tests easily extensible
Co-authored-by: Fabio Spaziani <[email protected]>
Co-authored-by: Fabio Spaziani <[email protected]>
|
Hi @stebet , that is awesome, thanks! I'll take a look at the changes in details in the nex few days, will ping back here. |
|
Hi @stebet , sorry for the delay, even though part of the blame for it is on your country... such an incredible place to visit 🙂 Anyway I've been finally able to resolve the conflict (by updating the SLN file to the new SLNX formt) and updated the branch. I also added a couple of Thanks! |
Added a NATS Backplane
I added a new project which uses NATS as a backplane for cache events. It's relatively straightforward
Reduced allocations for backplane messages
I also noticed some easy improvements that could be made to drastically reduce allocations for Backplane message, so I did a few things.
BackplaneMessageis now areadonly structinstead of a class which means it can be allocated on the stackBackplaneMessagenow has aTryParsestatic method which tries to deserialize aReadOnlySpan<byte>into aBackplaneMessageand now provides an instance methodWriteTowhich serializes theBackplaneMessageto anIBufferWriter<byte>with no allocations.Made Backplane Tests easily extensible
I made the L1BackplaneTests and the L1L2BackplaneTests abstract classes which can easily be inherited and implement methods to provide the
IFusionCacheBackplaneand theIDistributedCacheso tests for new backplane and Distributed Caches can easily be implemented.This could be further improved by making these test classes perhaps take the Backplane and Distributed cache as parameters for parameterized tests. I might look at doing it like that to make it even easier.