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

master: queries executed pre plugin boot #11932

Closed
jdalsem opened this issue Apr 23, 2018 · 5 comments
Closed

master: queries executed pre plugin boot #11932

jdalsem opened this issue Apr 23, 2018 · 5 comments

Comments

@jdalsem
Copy link
Member

jdalsem commented Apr 23, 2018

An Elgg boot sequence will take (with all caches enabled) 7 queries.

  1. Load all config
  2. Load site entity
  3. Load session
  4. Load logged in user entity
  5. Load metadata for user entity
  6. Get (i think 'all') plugin entities
  7. Get metadata for plugin entities

After this plugin logic happens

In the shutdown sequence 3 write queries happen:

  1. write logged in user metadata prev_last_action
  2. write logged in user entity table last_action
  3. write session to DB

Any ideas which queries are candidates for reduction? I think

  • loading all config (can happen in bootcache)
  • loading site entity (can happen in bootcache)
  • logged in user (with metadata) in session (maybe)
  • the plugin entities (some are retrieved from bootcache already, don't know why this is still happening)

If you want to check for yourself, pull #11931, as that already fixes a lot of unnecessary queries.

@hypeJunction
Copy link
Contributor

Load all config

The problem is site secret. @mrclay doesn't want it in boot cache

Load site entity
Load logged in user entity

These shouldn't be an issue with persistent cache (memcache or redis)

@mrclay
Copy link
Member

mrclay commented Apr 25, 2018

My feeling was that boot was reasonably optimized when I left it (starting to be a ton of work and regressions for marginal gain). An extra and fast query to keep a master key out of caches seems worth it...put it in settings.php. When I looked last views to render a full page were a pain point, so try not to do it :)

@hypeJunction
Copy link
Contributor

I agree that gains are marginal at this point.

@jdalsem
Copy link
Member Author

jdalsem commented Apr 25, 2018

The main reason i put it here was, because i analyzed the current need for queries. These queries mentioned were the result after i fixed a few bugs which resulted in having somewhere between 40 - 50 queries... so me solving them to get it back to 7 was pretty useful. This is what is left. I personally think having the plugin entities not cached could still be a bug. I will investigate that somewhat further. The rest is fine by me. Persistent entity caches probably will solve the site and user entity (i am not able to test that).

@jdalsem jdalsem added this to the Elgg 3.x milestone Jul 11, 2018
@jdalsem jdalsem removed this from the Elgg 3.x milestone Dec 19, 2018
@jdalsem jdalsem added this to the Elgg 4.0 - beta milestone Apr 16, 2021
@jdalsem
Copy link
Member Author

jdalsem commented May 12, 2021

No extra work needed at the moment

@jdalsem jdalsem closed this as completed May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants