Skip to content
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

Fix queue #19

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Fix queue #19

merged 4 commits into from
Apr 4, 2024

Conversation

tiagodaraujo
Copy link
Contributor

Description

  • Feature: Update the Grafana dashboard
    • Show queue time zero when we don't have anything in queue
    • Show concurrency and queue counters and limits on the same widget
  • Fix: Queue was decreased twice when items were rejected
  • Fix: Queue was not decreased if events are not defined
  • Fix: Report to the events (Processing and Queue) the current counter values (count and limit) instead of those at the event time

Fixes #16

How Has This Been Tested?

Run the load tests and at the end of the tests, the queue and concurrency gauge metrics should report the value zero.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

@tiagodaraujo
Copy link
Contributor Author

tiagodaraujo commented Mar 28, 2024

I just updated the pull request to remove the traits from Benchmark and Performance projects.

Additionally, I ran the benchmark tests in the main and fix-queue branches. The results showed CPU and Allocated Memory improvements.

The improvement occurs because the queue is now managed with an array instead of a dictionary. Additionally, because the counter mapper for the event argument class no longer exists, the arguments now receive a pointer to IReadOnlyCounter.

| Method                                       | Mean            | Error     | StdDev    | Min       | Max      | Rank | Completed Work Items | Lock Contentions | Allocated |
|--------------------------------------------- |----------------:|----------:|----------:|----------:|---------:|-----:|---------------------:|-----------------:|----------:|
MASTER
| TaskQueueWith1000Items_EnqueueFixedPriority  | 2.133 us        | 1.4382 us | 0.8559 us |  1.200 us | 4.000 us |    1 |                    - |                - | 592 B        |
| TaskQueueEmpty_EnqueueRandomPriority         | 1.730 us        | 0.7866 us | 0.5203 us |  1.150 us | 2.550 us |    1 |                    - |                - | 592 B        |
| TaskQueueWith1000Items_EnqueueRandomPriority | 1.400 us        | 0.1680 us | 0.1000 us |  1.300 us | 1.600 us |    1 |                    - |                - | 592 B        |
| TaskQueueWith1000Items_Dequeue               | 2.244 us        | 1.2578 us | 0.7485 us |  1.700 us | 4.000 us |    1 |                    - |                - | 544 B        |
| TaskQueue_EnqueueNewItem_LimitReached        | 4.878 us        | 3.6680 us | 2.1828 us |  3.400 us | 9.600 us |    2 |                    - |                - | 736 B        |
WITH FIX QUEUE
| TaskQueueWith1000Items_EnqueueFixedPriority  | 1.344 us (-37%) | 0.7282 us | 0.4333 us | 0.9000 us | 2.100 us |    1 |                    - |                - | 592 B (0%)   |
| TaskQueueEmpty_EnqueueRandomPriority         | 1.440 us (-17%) | 0.9487 us | 0.6275 us | 0.8000 us | 2.600 us |    1 |                    - |                - | 592 B (0%)   |
| TaskQueueWith1000Items_EnqueueRandomPriority | 1.012 us (-27%) | 0.1225 us | 0.0641 us | 0.9000 us | 1.100 us |    1 |                    - |                - | 592 B (0%)   |
| TaskQueueWith1000Items_Dequeue               | 3.500 us (+55%) | 2.1769 us | 1.4399 us | 1.7000 us | 6.000 us |    2 |                    - |                - | 472 B (-13%) |
| TaskQueue_EnqueueNewItem_LimitReached        | 2.756 us (-44%) | 1.6142 us | 0.9606 us | 2.0000 us | 4.500 us |    2 |                    - |                - | 592 B (-20%) |

CPU: -16%
Memory: -6%


| Method                           | Mean            | Error   | StdDev  | Min      | Max      | Rank | Gen0   | Completed Work Items | Lock Contentions | Allocated |
|--------------------------------- |----------------:|--------:|--------:|---------:|---------:|-----:|-------:|---------------------:|-----------------:|----------:|
MASTER
| Limiter_Default                  | 283.5 ns        | 10.81 ns | 6.43 ns | 270.6 ns | 291.3 ns |    2 | 0.0572 |               0.0000 |                - | 720 B        |
| Limiter_RandomPriority           | 270.2 ns        |  8.64 ns | 5.72 ns | 260.1 ns | 276.8 ns |    1 | 0.0572 |               0.0000 |                - | 720 B        |
| LimiterMiddleware_Default        | 301.4 ns        |  4.76 ns | 2.83 ns | 298.0 ns | 306.4 ns |    3 | 0.0648 |               0.0000 |                - | 816 B        |
| LimiterMiddleware_RandomPriority | 301.8 ns        |  6.63 ns | 3.47 ns | 294.4 ns | 306.0 ns |    3 | 0.0687 |               0.0000 |                - | 864 B        |
WITH FIX QUEUE
| Limiter_Default                  | 207.0 ns (-27%) |  6.80 ns | 4.50 ns | 198.4 ns | 212.5 ns |    1 | 0.0484 |               0.0000 |                - | 608 B (-16%) |
| Limiter_RandomPriority           | 211.7 ns (-22%) |  8.78 ns | 5.81 ns | 202.1 ns | 217.6 ns |    1 | 0.0484 |               0.0000 |                - | 608 B (-16%) |
| LimiterMiddleware_Default        | 233.0 ns (-23%) |  7.40 ns | 4.89 ns | 226.1 ns | 240.3 ns |    2 | 0.0560 |               0.0000 |                - | 704 B (-14%) |
| LimiterMiddleware_RandomPriority | 239.3 ns (-31%) |  5.73 ns | 3.79 ns | 231.8 ns | 244.6 ns |    3 | 0.0596 |               0.0000 |                - | 752 B (-13%) |

CPU: -26%
Memory: -15%

@ailtonguitar ailtonguitar changed the base branch from main to fix-queue April 3, 2024 11:33
@kikofps kikofps merged commit 08ead5a into Farfetch:fix-queue Apr 4, 2024
2 checks passed
@kikofps
Copy link

kikofps commented Apr 4, 2024

Hi @tiagodaraujo ,
Just releasing this pull request to a beta version, you can find here.

@tiagodaraujo tiagodaraujo mentioned this pull request Apr 8, 2024
4 tasks
tiagodaraujo added a commit to tiagodaraujo/loadshedding that referenced this pull request May 7, 2024
* feat: grafana dashboard V2

* fix: decrease queue once on reject

* fix: queue gauge metric

* chore: remove xUnit traits from Benchmark and Performance projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Report waiting time for no waiting tasks
8 participants