Skip to content

Conversation

BacLuc
Copy link
Contributor

@BacLuc BacLuc commented Mar 5, 2024

With our performance problems in prod (starting with the failure to print a camp with 170 activities) i tried to find a way
that we can see in development or even tests, how the query planner plans the queries and how we can optimize this before we are in production.

This is the most practical solution, but the time for the queries is still too flaky to test it.

Now ready for review with an upper limit for the query time.

@BacLuc BacLuc force-pushed the db-performance-tests branch from 75a5b82 to 20801e1 Compare March 5, 2024 21:08
@BacLuc BacLuc changed the title Db performance tests api: add performance_test environment which loads more data Mar 5, 2024
@BacLuc BacLuc added the Meeting Discuss Am nächsten Core-Meeting besprechen label Mar 5, 2024
@manuelmeister
Copy link
Member

Core Meeting Discussion

  • Implement upper limit test for execution time
  • Runs nightly and upon label "api-performance-test!"

@manuelmeister manuelmeister removed the Meeting Discuss Am nächsten Core-Meeting besprechen label Mar 6, 2024
@BacLuc BacLuc force-pushed the db-performance-tests branch from 20801e1 to 929f1e4 Compare March 6, 2024 22:44
@BacLuc BacLuc marked this pull request as ready for review March 6, 2024 23:01
@BacLuc
Copy link
Contributor Author

BacLuc commented Mar 31, 2024

Core Meeting Discussion

  • Implement upper limit test for execution time
  • Runs nightly and upon label "api-performance-test!"

Done

@BacLuc BacLuc requested review from pmattmann and usu and removed request for pmattmann and usu April 13, 2024 14:33
@BacLuc BacLuc force-pushed the db-performance-tests branch from 929f1e4 to 031b319 Compare April 13, 2024 22:49
BacLuc added 6 commits April 14, 2024 00:51
Add a threshold that we don't accidentally add a slow query.
That we can have a snapshot for the test environment,
and one for the performance_test environment.
To test our application against more data.
This uses the feature of the AliceBundle that
the fixtures can be loaded depending on the environment.
(https://github.com/theofidry/AliceBundle/blob/ab4d7ffd04eef576df4af88630ebb49bba397e40/doc/advanced-usage.md#environment-specific-fixtures)

We need that because the nelmio/alice takes a while to generate lots of data,
thus we don't want to do this for every test.

We need a database with more data to test our application against
a postgres instance which needs to use its indices.
Else it will just do a full table scan every time and this is fine
with 5 entries in the table.
But if it then reaches to an inefficient query plan as soon as
we have a lot of data, we face issues in production.
This allows us to test that before it happens in production.

The amount of additional data in additional camps has to be balanced.
Now it takes 50s on a fairly good machine to load all these fixtures.
If we later also add more activities to camp1, we cannot load
a lot more additional camps.
With 1000 additional camps and 100 additional activities for camp1
it took 15 min to load the fixtures.
That camp1 is more realistic:
activity-progress-labels.yml: add 3 more
activityResponsibles.yml: add 200 (to all activities)
activityResponsibles.yml: add 10
materialItems.yml:
- add 1 to additional_materialList_camp1_1 for each materialnode
- add 200 items to additional_materialList_camp1_1 for materialnode additional_materialNode_camp1_1
materialLists.yml: add 12
activities.yml: add 200
Do not add it to every PR or push for now, run it overnight
and if the label is set on a PR.
We don't know if the tests are flaky, and they need quite some resources.
…y() matcher

Like this you see what was in the array.
@BacLuc BacLuc force-pushed the db-performance-tests branch from 031b319 to 53cc23a Compare April 13, 2024 23:02
@BacLuc BacLuc enabled auto-merge April 13, 2024 23:02
@BacLuc BacLuc added this pull request to the merge queue Apr 13, 2024
Merged via the queue into ecamp:devel with commit bef490c Apr 13, 2024
@manuelmeister manuelmeister mentioned this pull request Apr 13, 2024
@BacLuc BacLuc deleted the db-performance-tests branch May 26, 2024 11:47
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.

4 participants