State of the project and future plans #120
Replies: 6 comments 9 replies
-
I totally agree! But many are sceptical or just don't get it. Or it's a bad idea, poorly implemented or poorly communicated. There are not many nuget downloads, likes or forks. I've had contact with maybe 10-20 people that have evaluated, often an enthusiastic developer that in the end get a NO from management. We're running both Memstate and the predecessor OrigoDB in production. OrigoDB (Net Framework 4.x only) is trustworthy but needs a package update, haven't touched the code in years. Memstate is a work in progress. I had to switch to some urgent tasks while in the middle of a major internal redesign, hopefully I can pick up from where I left when things calm down. I did a POC using memstate in November using SqlStreamStore with SqlServer as a backing store. We are doing GeoLocation lookups and triangulation against an evolving model of well known locations. That code is now running in prod! The next application will be an Organisation model with a hierarchical organisation tree, resources and a resource based permissions/policies. We want this in memory to save database roundtrips just for resource based authorization and memstate so we can have a synchronized replica on each application server. |
Beta Was this translation helpful? Give feedback.
-
I've been pouring over the code recently. This is a really cool project! Do you any thoughts around modifying how the reader/writer lock works, where the entire model is locked for writes? I completely understand why you went this direction. It works (and works well) and it's simple, but this does mean that read and write performance is coupled. And from what I can tell in the code, reads and writes are treated equally (no priority is given to one or the other). Of course, you could just do heavy writes during off-hours, but I'm curious if you've had any thoughts around decoupling (to an extent, of course) read and write performance so that we can have both sustained reads and sustained writes. If so, I'd love to help if you're looking for it. |
Beta Was this translation helpful? Give feedback.
-
Hi Michael |
Beta Was this translation helpful? Give feedback.
-
Hi Michael, nice to get some attention around here, that could inspire things to start moving again :) I don't think the ReaderWriterLockSlim will starve out readers when there is constant pressure from writes. But even if there is high pressure there is always a small window of time to squeeze in a few million queries while waiting for the commands to flush to disk or return from EventStore / RDBMS depending on the type of underlying storage. It is of course important that the commands execute quickly, it is only during execution that the lock is held. But there is a pattern that can be used to never block reads. If the entire model is immutable then it's always safe to read. Commands need to run in series and return the next state of the model. An added bonus is if a command fails with an exception there is no risk of a semi failed transaction, so atomicity is now a guarantee of the system instead of a developer responsibility. Memstate is a redesign of OrigoDB which targets .NET Framework which had this behavior as an option. I considered making it the default when starting out with memstate but it felt a bit too bold and opinionated. Now that we have c# records and the with keyword, it makes much more sense.
The benchmarks using EventStore run at near 100K sustained commands per second (eventstore maximum) and millions of queries per second in parallel with the commands at full throttle! This was with a key/value model using simple reads and writes but still pretty impressive. At this rate of commands the problem becomes dealing with billions of journal records. Storage, storage cost, time to replay during startup, etc... |
Beta Was this translation helpful? Give feedback.
-
Hi, this is great! An "immutable model" pattern was exactly the direction I was leaning as well. I also thought a bit about somehow having small partitions to localize the locks, but without an addressing system (like through a key) that memstate knows about, partitioning is a bit difficult here. Glad you also mentioned snapshotting. I had some high-level thoughts about how to snapshot asynchronously so that read/writes continue while the snapshot is persisting. This means that the snapshot might be a bit behind the current model, but you can just apply committed events to the snapshot after restoring. But, these both seem like "nice to haves" since it looks like even with heavy sustained writes, memstate performs well. Also, from what I can tell with my own tests, reading a large journal is still fast with an SSD. Snapshotting, though, is probably the feature I'd prioritize though just so that my services start as quickly as possible. Happy to help with this feature if you're looking for help. |
Beta Was this translation helpful? Give feedback.
-
Some background for new readers; using memstate as a backing db for a CRUD system, e.g. content management system, is currently not a good fit with memstate because you end up creating a potentially expensive "large" journal record representing the "C" or "U" commands on every command, that would have to contain the text or body/content of the resource being updated. For example if you were building an ecommerce application, typically you'd use memstate for the mission critical domain commands split into micro services, ordering, billing, payments etc; these would be small and critical, and then have a normal table database like Postgres for the products, users, shopping basket services. Effective snapshots could possibly ? solve this problem and open up a whole host of very powerful and effective use cases with immediate benefits for teams of all sizes. |
Beta Was this translation helpful? Give feedback.
-
Hi,
this project looks really great and I think something like this is greatly needed, especially for CQRS related projects.
Is this project still actively developed? What are the plans for the foreseeable future? Do you intend to continue development?
I would really love to use this DB in my projects but I am a little hesitant to do so since it seems to have quite a small user base at the moment unfortunately.
I would be really grateful for some infos on this!
Beta Was this translation helpful? Give feedback.
All reactions