fiskaltrust / middleware

The fiskaltrust.Middleware is an integrated set of highly configurable software components for POS systems to abstract the complexity of national fiscalization laws.
https://docs.fiskaltrust.eu
European Union Public License 1.2
8 stars 4 forks source link

FR - Growing latencies on copy receipts #242

Open mertcanyalhi opened 9 months ago

mertcanyalhi commented 9 months ago

Summary

Although the recent change (#192) improved the performance of the signature requests for copy receipts, we're observing an increasing trend for copy receipt latencies, which started to cause performance issues in our integrations.

We have outlets with >200K queue items and a CNumerator of nearly 5K. We noticed that the latencies have direct correlation with the number of queue items, which can be seen in the table below.

The table shows the correlation of copy receipt latency (red, left y-axis) and number of queue items (yellow, right y-axis) for multiple outlets (x-axis):

image

Impact

The impact can be seen in the sub-sections for each store. Each sub-section shows the queue size, CNumerator, and a latency heatmap for:

TL;DR:

Store A

Latency heatmap for all receipts:

image

Latency heatmap for copy receipts:

image

Latency heatmap for other receipts:

image

When we focus on the copy receipt latencies, it can be seen that the latency of the subsequent copy receipt requests that are made in a certain window is always lower. This can be the result of an index cache on the data layer. The table below shows copy receipt requests that are grouped in equal time windows:

image

Findings:

Store B

Latency heatmap for all receipts:

image

Latency heatmap for copy receipts:

image

Latency heatmap for other receipts:

image

Findings:

Store I

Latency heatmap for all receipts:

image

Latency heatmap for copy receipts:

image

Latency heatmap for other receipts:

image

Findings:

Expectations

As SaaS and PaaS providers, our expectation is to have stable latencies regardless of the queue size. Growing queue size will cause delays or even interruptions in receipt printing, and as a result, degraded customer experience.

mertcanyalhi commented 8 months ago

Just wanted to check if there is any update, or anything we can help with πŸ™

CC: @TSchmiedlechner @volllly

TSchmiedlechner commented 7 months ago

Hi @mertcanyalhi, thanks a lot for these very detailed analysis, very appreciated! Indeed it looks like the scaling of the intermediate fix we had deployed for #192 did improve the situation, but still doesn't scale perfectly - although the rate of the performance deterioration became much slower, that's very obviously not enough.

We've implemented a second fix that decouples the copy receipt performance from the number of processed receipts and should change the complexity from O(n) to O(1). We're currently working on deploying this, ETA is somewhat about ~2 weeks in my opinion - I'll keep you posted. Sorry about the inconvenience, and again, thanks for the super helpful problem description. 😊

mertcanyalhi commented 7 months ago

Hey @TSchmiedlechner, thanks for the information and your efforts πŸ™ please let me know if we can provide any further input or help you in any way