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

Improve kanban performances 3 #14764

Conversation

AdrienClairembault
Copy link
Contributor

@AdrienClairembault AdrienClairembault commented May 23, 2023

Following #14525 and #14599.

I've found another bottleneck that was slowing down the loading of the kanban page.

Each columns are loaded by an ajax request, which will find all the tickets of that column.
Then, for each tickets found, we load some extra data (actors and linked tickets).

This quickly become a costly operation as it require at least ~10 extra SQL requests for each ticket to load this extra data (so for 100 tickets, you run 1000 extra queries).

I've improved the performances massively by bulk loading all the extra data using a few SQL queries.
Then for each ticket we can just reach for the data in the preloaded arrays.

The small downside is that we use a bit more of memory but it seems reasonable (8mb for ~500 tickets).
If memory become a problem for massive databases (which would probably require ~30k open tickets to break a 256mb limit) , we can always split the process in X tickets batches.

Regarding the benchmark, I've used a test database with around 130k tickets.
Most tickets are closed, the biggest non-closed column had ~550 tickets:

image

Before the changes, the biggest column would take almost 2 seconds to load.
After the changes, it only take around 0.3 seconds.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets !27631

Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steps data seems to have disappeared, is this intended?

@AdrienClairembault
Copy link
Contributor Author

steps data seems to have disappeared, is this intended?

No, it seems I've put in in _links instead by mistake.

Copy link
Member

@cedric-anne cedric-anne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is hard to read, but it seems OK.

@AdrienClairembault
Copy link
Contributor Author

It is hard to read, but it seems OK.

Code could probably be split into multiple functions (which could then be unit tested) but I wanted to keep things simple for a bugfixes PR.

@cedric-anne cedric-anne merged commit 74038df into glpi-project:10.0/bugfixes May 25, 2023
@AdrienClairembault AdrienClairembault deleted the fix/kanban-performances-3 branch October 4, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants