-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Signed-off-by: Sami Salonen <[email protected]>
- buffering data in the PersistenceService, and writing it in batches. We get performance gains by writing data in batches but also reduce items queue pressure in GenericItem.notifyListeners. - previously several checks were done on each store, causing significant overhead: 1) connection check (listing tables), 2) checking table existence. These are now removed, table is created on error (ResourceNotFoundException). Signed-off-by: Sami Salonen <[email protected]>
With the old version, I could see that sometimes It's hard to diagnose what is the root cause for these occasional issues but I think writing in batches should be able to deal with even larger backlogs of data. |
Anything I can do to progress this? |
@ssalonen Would be cool if you could help on getting dynamodb (incl. your improvements) ready in https://github.com/openhab/openhab2-addons/pull/5275 - this is one of the addons, which I didn't yet spend the work to make it compile with bnd as it has a huge list of included libs. Feel free to create a PR against my branch of that PR - merging your improvements should be very easy as I didn't do any real changes to the source code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few little tweaks.
...amodb/java/org/openhab/persistence/dynamodb/internal/AbstractBufferedPersistenceService.java
Outdated
Show resolved
Hide resolved
...amodb/java/org/openhab/persistence/dynamodb/internal/AbstractBufferedPersistenceService.java
Outdated
Show resolved
Hide resolved
...amodb/java/org/openhab/persistence/dynamodb/internal/AbstractBufferedPersistenceService.java
Outdated
Show resolved
Hide resolved
...ence.dynamodb/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java
Outdated
Show resolved
Hide resolved
...ence.dynamodb/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Sami Salonen <[email protected]>
Signed-off-by: Sami Salonen <[email protected]>
Thanks, @ssalonen ! |
@ssalonen Could you please have a look at https://ci.openhab.org/job/openHAB1-Addons/lastCompletedBuild/org.openhab.persistence$org.openhab.persistence.dynamodb.test/testReport/? It seems that this PR made one test fail now. |
This PR introduces several performance optimizations to DynamoDB Persistence Service:
We get performance gains by writing data in batches but also reduce
items
QueueingThreadPoolExecutor.taskQueue
pressure inGenericItem.notifyListeners
.significant overhead on
store
andquery
operations: 1) connection check(listing tables), 2) checking table existence. These are now removed,
table is created on error (
ResourceNotFoundException
).In addition, I have implemented exponential back-off retry for writes.
I've been verified the changes in my local setup. Before I could see that
QueueingThreadPoolExecutor.taskQueue
size growed (temporarily, but still) up to 500-1500 when many items were persisted at the same time. Dealing with the queue took some noticeable time. With the improvements, the size remains close to zero all the time.Signed-off-by: Sami Salonen [email protected]