-
-
Notifications
You must be signed in to change notification settings - Fork 526
Open
Description
Let's say you're starting a brand new, green field application with Marten & Wolverine and you want to use every little "opt in" flag in Marten that helps your application perform better and scale better as well as have all the robustness things turned on. I've long thought we'd add a single config method that does just that.
From a blog post I was working on anyway, I'm proposing that:
// NOT wedded to the API name here
opts.UseOptimizedGreenfieldOptions();is the same as this, w/ maybe requiring you to specify to use middle tier timestamps or server side timestamps
var builder = Host.CreateApplicationBuilder();
builder.Services.AddMarten(m =>
{
// Much more coming...
m.Connection(builder.Configuration.GetConnectionString("marten"));
m.Events.AppendMode = EventAppendMode.Quick;
// or if you care
// 50% improvement in throughput, less "event skipping"
m.Events.AppendMode = EventAppendMode.QuickWithServerTimestamps;
// 100% do this, but be aggressive about using it
m.Events.UseArchivedStreamPartitioning = true;
m.Events.EnableAdvancedAsyncTracking = true;
m.Events.EnableEventSkippingInProjectionsOrSubscriptions = true;
m.Events.UseIdentityMapForAggregates = true;
m.Events.UseMandatoryStreamTypeDeclaration = true;
})
// This will remove some runtime overhead from Marten
.UseLightweightSessions()Ramifications
- You'd have to use
FetchForWriting()for all event appending if you want to use event metadata like theVersionorTimestampinInlineprojections -- but you really should anyway - LIkewise, the "use identity map for aggregate" option will break people who use that old "AggregateRoot" pattern, but I'm trying to discourage that usage anyway:)
- The mandatory stream type thing just helps a lot of book keeping later on
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels