Opened 10 years ago
Closed 4 years ago
#12167 closed Patch - Feature (Unverified)
Improve caching to reduce SQL queries
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | MythTV - General | Version: | Unspecified |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
mythfrontend make allot of SQL queries when when it is launched, and this affects the time it takes to launch the frontend quite significantly when you have a relatively slow master backend.
Allot of the time is spent querying the settings table for a single value at a time, and for querying the keymappings a single key at a time.
I have made 2 PoC patches showing it is possible to to eliminate almost all of these SQL queries which reduces launch time from 18 secs. to 4-5 secs with a Cortes A8 1GHz master backend.
mythtv_poc_improve_caching_of_host_settings.patch:
- Enable caching if settings a little earlier.
- When enabling settings cache query all host specific and global settings from master backend.
- If cache is enabled and a key is not found in the cache don't fall back to querying master backend since we should be synchronized.
- Use HostSettingStorage? instead of HostDBStorage for Settings menus. HostSettingStorage? gets/sets settings via MythDB which is cached. (can be extended to also work with global settings as well)
- Reduces load time by ca. 9 secs. for me.
mythtv_poc_cache_all_keybindings.patch:
- Cache all keymappings and make use of it when binding keys.
- Reduces load time by ca. 4 secs. for me.
I know these patches are little rough, but I would like to know if you are interested in changes along these lines.
Attachments (3)
Change History (12)
Changed 10 years ago by
Attachment: | mythtv_poc_improve_caching_of_host_settings.patch added |
---|
Changed 10 years ago by
Attachment: | mythtv_poc_cache_all_keybindings.patch added |
---|
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Owner: | set to JYA |
---|---|
Status: | new → accepted |
comment:3 Changed 10 years ago by
i wonder how initial settings are read when you have options set like starting mythfrontend with -p (to choose the backend etc)
i have strong suspicions it will introduce a regression
comment:4 Changed 10 years ago by
good point, I suspect you may be right.
I'll try the -p option, and see what happens.
comment:5 Changed 10 years ago by
I cannot test the -p option because it doesn't even work without my changes see #12217
comment:6 Changed 10 years ago by
So I managed to test the -p option, and to my surprise It actually does work without any changes.
I did find some other bugs.
mythtv_poc_improve_caching_of_host_settings_v2.patch:
- Implement HostSettingStorage::Save() properly - changes are now saved =)
- Properly detect when a setting doesn't exist HostSettingStorage?(when to use default value).
Changed 10 years ago by
Attachment: | mythtv_poc_improve_caching_of_host_settings_v2.patch added |
---|
comment:7 Changed 8 years ago by
Owner: | changed from JYA to Lawrence Rust |
---|---|
Status: | accepted → assigned |
Jean-Yves
This bug is probably fixed by some of the database caching patches that I've proposed (devel/lvr/startup branch). If you have no objection I would like to take this on...
comment:8 Changed 8 years ago by
Owner: | Lawrence Rust deleted |
---|---|
Status: | assigned → new |
comment:9 Changed 4 years ago by
Resolution: | → Unverified |
---|---|
Status: | new → closed |
Closing all old tickets in trac.
If your issue still persists, please open an issue in Github https://github.com/MythTV/mythtv/issues
and reference the existing trac ticket.
thank you for your patch.
please make the new verbosity "debug", not info.
Please follow mythtv coding style: http://www.mythtv.org/wiki/Coding_Standards
in particular braces and spaces