Skip to content

Commit 032b2e0

Browse files
committed
Tuning
1 parent a59ae74 commit 032b2e0

6 files changed

Lines changed: 24 additions & 9 deletions

File tree

Propulsion.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Propulsion.DynamoStore", "s
5353
EndProject
5454
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Propulsion.DynamoStore.Lambda", "src\Propulsion.DynamoStore.Lambda\Propulsion.DynamoStore.Lambda.fsproj", "{0EE2957C-92FC-4D8D-9783-A48B9BE032B7}"
5555
EndProject
56+
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Equinox.DynamoStore", "..\equinox\src\Equinox.DynamoStore\Equinox.DynamoStore.fsproj", "{BC68A82F-B702-4742-97A7-7B04D4293E47}"
57+
EndProject
5658
Global
5759
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5860
Debug|Any CPU = Debug|Any CPU
@@ -115,6 +117,10 @@ Global
115117
{0EE2957C-92FC-4D8D-9783-A48B9BE032B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
116118
{0EE2957C-92FC-4D8D-9783-A48B9BE032B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
117119
{0EE2957C-92FC-4D8D-9783-A48B9BE032B7}.Release|Any CPU.Build.0 = Release|Any CPU
120+
{BC68A82F-B702-4742-97A7-7B04D4293E47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
121+
{BC68A82F-B702-4742-97A7-7B04D4293E47}.Debug|Any CPU.Build.0 = Debug|Any CPU
122+
{BC68A82F-B702-4742-97A7-7B04D4293E47}.Release|Any CPU.ActiveCfg = Release|Any CPU
123+
{BC68A82F-B702-4742-97A7-7B04D4293E47}.Release|Any CPU.Build.0 = Release|Any CPU
118124
EndGlobalSection
119125
GlobalSection(SolutionProperties) = preSolution
120126
HideSolutionNode = FALSE
@@ -134,6 +140,7 @@ Global
134140
{A1964569-C6A9-46D3-8DD9-01E04AF8CC81} = {4670F7C4-A4FD-4E3F-B97C-99F9B3FC1898}
135141
{0B1D505F-FD80-428E-92E5-4367E95E96DF} = {4670F7C4-A4FD-4E3F-B97C-99F9B3FC1898}
136142
{0EE2957C-92FC-4D8D-9783-A48B9BE032B7} = {4670F7C4-A4FD-4E3F-B97C-99F9B3FC1898}
143+
{BC68A82F-B702-4742-97A7-7B04D4293E47} = {4670F7C4-A4FD-4E3F-B97C-99F9B3FC1898}
137144
EndGlobalSection
138145
GlobalSection(ExtensibilityGlobals) = postSolution
139146
SolutionGuid = {DF04AF73-7412-46E5-9CC8-15CB48E3139A}

src/Propulsion.DynamoStore.Lambda/Connector.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type Configuration(?tryGet) =
2121
open Equinox.DynamoStore
2222

2323
type Connector(serviceUrl, accessKey, secretKey, table) =
24-
let retries, timeout, queryMaxItems, maxBytes = 10, System.TimeSpan.FromSeconds 60., 50, 64*1024
24+
let retries, timeout, queryMaxItems, maxBytes = 10, System.TimeSpan.FromSeconds 60., 100, 48*1024
2525

2626
let conn = DynamoStoreConnector(serviceUrl, accessKey, secretKey, retries, timeout)
2727
let client = conn.CreateClient()

src/Propulsion.DynamoStore.Lambda/aws-lambda-tools-defaults.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"region": "",
1010
"configuration": "Release",
1111
"function-runtime": "dotnet6",
12-
"function-memory-size": 128,
13-
"function-timeout": 120,
12+
"function-memory-size": 192,
13+
"function-timeout": 180,
1414
"function-architecture": "arm64",
1515
"function-handler": "Propulsion.DynamoStore.Lambda::Propulsion.DynamoStore.Lambda.Function::FunctionHandler"
1616
}

src/Propulsion.DynamoStore/AppendsEpoch.fs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,20 @@ type Service internal (shouldClose, resolve : AppendsTrancheId * AppendsEpochId
110110

111111
let isSelf p = IndexStreamId.toStreamName p |> FsCodec.StreamName.splitCategoryAndId |> fst = Category
112112
if spans |> Array.exists (function { p = p } -> isSelf p) then invalidArg (nameof spans) "Writes to indices should be filtered prior to indexing"
113-
decider.Transact(Ingest.decide shouldClose spans, if assumeEmpty = Some true then Equinox.AssumeEmpty else Equinox.AllowStale)
113+
decider.TransactEx((fun (c : Equinox.ISyncContext<_>) -> async {
114+
return Ingest.decide (shouldClose c.Version) spans c.State
115+
}), (fun r _c -> r), if assumeEmpty = Some true then Equinox.AssumeEmpty else Equinox.AllowStale)
114116

115117
module Config =
116118

117119
let private resolveStream (context, cache) =
118120
let cat = Config.createUnoptimized Events.codec Fold.initial Fold.fold (context, Some cache)
119121
cat.Resolve
120-
let create log maxItemsPerEpoch store =
121-
let shouldClose totalItems = totalItems >= maxItemsPerEpoch
122+
let create (log : Serilog.ILogger) (maxVersion, maxItemsPerEpoch) store =
123+
let shouldClose version totalStreams =
124+
let closing = version >= maxVersion || totalStreams >= maxItemsPerEpoch
125+
if closing then log.Information("Closing v{version} Streams {streams}", version, totalStreams)
126+
closing
122127
let resolve = streamName >> resolveStream store >> Config.createDecider log
123128
Service(shouldClose, resolve)
124129

src/Propulsion.DynamoStore/DynamoStoreIndexer.fs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
namespace Propulsion.DynamoStore
22

3-
type DynamoStoreIndexer(log : Serilog.ILogger, context, cache, ?maxItemsPerEpoch, ?storeLog) =
3+
type DynamoStoreIndexer(log : Serilog.ILogger, context, cache, ?maxItemsPerEpoch, ?maxVersion, ?storeLog) =
4+
let maxVersion = defaultArg maxVersion 2_000
45
let maxItemsPerEpoch = defaultArg maxItemsPerEpoch 100_000
56
do if maxItemsPerEpoch > AppendsEpoch.MaxItemsPerEpoch then invalidArg (nameof maxItemsPerEpoch) "Cannot exceed AppendsEpoch.MaxItemsPerEpoch"
67
let storeLog = defaultArg storeLog log
78
let log = log.ForContext<DynamoStoreIndexer>()
89

910
let ingester =
10-
let epochs = AppendsEpoch.Config.create storeLog maxItemsPerEpoch (context, cache)
11+
let epochs = AppendsEpoch.Config.create storeLog (maxVersion, maxItemsPerEpoch) (context, cache)
1112
let index = AppendsIndex.Config.create storeLog (context, cache)
1213
let createIngester trancheId =
1314
let log = log.ForContext("trancheId", trancheId)

src/Propulsion.DynamoStore/Propulsion.DynamoStore.fsproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424

2525
<PackageReference Include="FSharp.Core" Version="4.7.2" />
2626

27-
<PackageReference Include="Equinox.DynamoStore" Version="4.0.0-beta.2" />
27+
<!-- <PackageReference Include="Equinox.DynamoStore" Version="4.0.0-beta.4" />-->
2828
<PackageReference Include="FsCodec.SystemTextJson" Version="3.0.0-rc.2.2" />
2929
</ItemGroup>
3030
<ItemGroup>
3131
<ProjectReference Include="..\Propulsion.Feed\Propulsion.Feed.fsproj" />
32+
<ProjectReference Include="..\..\..\equinox\src\Equinox\Equinox.fsproj" />
33+
<ProjectReference Include="..\..\..\equinox\src\Equinox.DynamoStore\Equinox.DynamoStore.fsproj" />
3234
</ItemGroup>
3335

3436
</Project>

0 commit comments

Comments
 (0)