-
Notifications
You must be signed in to change notification settings - Fork 30
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
Improve OutboxRecord delete performance #148
Comments
@WilliamBZA I've created this issue to track the perf problem the user reported. |
The outbox concept should be re-evaluated. In high throughput scenarios the Outbox table doesn't scale and the delete isn't able to keep up and results in table locks - especially with multiple services using a shared enpoint. Potential solutions that may help (need a test harness first)
Example of batched delete statement (would need to convert to NHQL) WHILE 1 = 1
BEGIN
WITH t AS
(
SELECT TOP 1000 *
FROM MyTable
WHERE MyField = 'abc123'
)
DELETE t
IF @@ROWCOUNT < 1000 BREAK
END |
@WilliamBZA This cannot be translated to NHQL as this is not ANSI SQL is it? This also relates to #143 In high throughput environments we should run the purging query in a much higher interval. The default of a minute really does not make sense. |
@ramon Probably not. But the whole query doesn't need to be NHQL. We could do the while loop in C# and the delete in NH. |
@WilliamBZA Doing to the loop in c# means you need to query for ID's and then do a batched delete on those ID's. The autosensing behavior that I just put in a comment of #143 is probably the best solution when using NHibernate. |
@ramonsmits why would you have to query the ID's? A SQL CommandReader (I don't know NHibernate well enough) would look like:
|
@WilliamBZA That is not using NHibernate, you are now by passing it and you are using TSQL specific TOP query which cannot be used with for example Oracle. Bypassing is usually not an issue when using ANSI SQL but in this case it is. |
@ramonsmits Ah, following you now. |
An alternative could be to have a fixed-size outbox for each endpoint. Then we would use |
Unfortunately HQL does not allow limited deletes so this idea can't be implemented. |
Raised via GG https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/particularsoftware/nj0wMiucx_k/9AsTSTziDQAJ
Possibly related to #144
The text was updated successfully, but these errors were encountered: