If you’re stumbling in here without any knowledge of the Marten project (or me), Marten is an open source .Net library that developers can adopt in their project to use the rock solid Postgresql database as a pretty full featured document database and event store. If you’re unfamiliar with Marten, I think I’d say its feature set makes it similar to MongoDb (but the usage is significantly different), RavenDb, or Cosmos Db. On the event sourcing side of things, I think the only comparison in .Net world is GetEventStore itself, but you can certainly piece together an event store by combining other OSS libraries and database engines.
The Marten community is working very hard on our forthcoming (and long delayed) V4.0 release. We’ve already made some big strides on the document database side of things, and now we’re deep into some significant event store improvements (this link looks best in VS Code w/ the Mermaid plugin active). At Calavista, we’re considering if and how we can build a development practice around Marten for existing and potential clients. I’ve obviously got a lot of skin in the game here as the original creator of Marten. Nothing would make me happier than Marten being even more successful and that I get to help Calavista clients use Marten in real life systems as part of my day job.
I’d really like to hear from other folks what it would really take for them to seriously consider adopting Marten. What is Marten lacking now that you would need, or what kind of community or company support options would be necessary for your shop to use Marten in projects? I’m happy to hear any and all feedback or suggestions from as many people as I can get to respond.
I’m happy to take comments here, or the discussion for this topic is also on GitHub.
- Marten is only a library, and at least for the document database features it’s very unobtrusive into your application code compared to many other persistence options
- The Marten community is active and I hope you’d say that we’re welcoming to newcomers
- By building on top of Postgresql, Marten comes with good cloud support from all the major cloud providers and plenty of existing monitoring options
- Marten comes with many of the very real productivity advantages of a NoSQL solution, but has very strong transactional support from Postgresql itself
- Marten’s event sourcing functionality comes “in the box” and there’s less work to do to fully incorporate event sourcing — including the all important “read side projection” support — into a .Net architecture than many other alternatives
- Marten is part of the .Net Foundation
- If you need commercial support for Marten, you can engage with Calavista Software.
Does any of that resonate with you? If you’ve used Marten before, is there anything missing from that list? And feel free to tell me you’re dubious about anything I’m claiming in the list above.
What’s already done or in flight
- We made a lot of improvements to Marten’s Linq provider support. Not just in terms of expanding the querying scenarios we support, but also in improving the performance of the library across the board. I know this has been a source of trouble for many users in the past, and I’m excited about the improvements we’ve made in V4.
- The event store functionality will get a lot more documentation — including sample applications — for V4
- An important part of many event sourcing architectures is a background process to continuously build “projected” views of the raw events coming in. The current version of Marten has this capability, but it requires the user to do a lot of heavy architectural lifting to use it in any kind of clustered application. In V4, we’ll have an in the box recipe that will be used to do leader election and work distribution through an application cluster in “real server applications.” The asynchronous projection support in V4 will also support multi-tenancy (finally) and we have some ideas to greatly optimize projection rebuilds without system downtime
- Using native Postgresql sharding for scalability, especially for the event store
- Allowing users to specify event archival rules to keep the event store tables smaller and more performant
- Adding more integration with .Net’s generic HostBuilder and standard logging abstractions for easier integration into .Net applications
- Improving multi-tenancy usage based on user feedback
- Document and event store metadata capabilities like you’d need for Marten to take part in end to end Open Telemetry tracing within your architecture.
- More sample applications. To be honest, I’m hoping to find published reference applications built with Entity Framework Core and shift them to Marten. This might be part of an effort to show Jasper as a replacement for MediatR or NServiceBus/MassTransit as well.
And again, does any of that address whatever concerns you might have about adopting Marten? Or that you’d already had in the past?
Here are some other ideas that have been kicked around for improving Marten usage, but these ideas would probably need to come through some sort of Marten commercialization or professional support.
- Cloud hosting recipes. Hopefully through Calavista projects, I’d like to develop some pre-built guidance and quick recipes for standing up scalable and maintainable Marten/Postgresql environments on both Azure and AWS. This would include schema migrations, monitoring, dynamic scaling, and any necessary kind of database provisioning. I think this might get into Terraform/Pulumi infrastructure as well.
- Cloud hosting models for parallelizing and distributing work with asynchronous event projections. Maybe even getting into dynamic scaling.
- Multi-tenancy through separate databases for each client tenant. You can pull this off today yourself, but there’s a lot of things to manage. Here I’m proposing more cloud hosting recipes for Marten/Postgresql that would include schema migrations and distributed work strategies for processing asynchronous event projections across the tenant databases.
- Some kind of management user interface? I honestly don’t know what we’d do with that yet, but other folks have asked for something.
- Event streaming Marten events through Kafka, Pulsar, AWS Kinesis, or Azure Event Hubs
- Marten Outbox and Inbox approaches with messaging tools. I’ve already got this built and working with Jasper, but we could extend this to MassTransit or NServiceBus as well.
2 thoughts on “What would it take for you to adopt Marten?”
When looking at Marten for our organization a little over a year ago, support was the reason we decided against using it. Since this is a database and not a nuget package, it can’t be easily replaced if it is no longer kept up-to-date. We felt that enterprise level support was extremely important for our databases.
Even today, looking at the Marten website it doesn’t appear to offer support even though in this blog post you mentioned that support is offered through Calavista.
Thanks for your comment. *Technically*, Marten is just a library and Postgresql certainly has wide support at the very least. The “Calavista can provide commercial support” thing is a very recent thing, and we’ll make a bigger deal of that in the docs for v4. I think we’re gonna end up doing a massive overhaul of the website, and that’s something we’ll keep in mind.