Performance Issues and Timeouts #1465
Replies: 7 comments 3 replies
-
Thanks for the writeup! Speaking for me, the issue is known at least internally. The design decision was on purpose after the re-write of cb1 (wielebenwir/cb-legacy), which had your proposed table design implemented. The argument was to leverage wordpress's system around posts and meta fields. Though I did not decide it. You already gave the answer to the problem. Because you are not the first one to encounter the problem (for wordpress and also for commonsbooking), there is already an plugin for the purpose of indexing wp posts and meta fields! Because I also encountered the problem, I have at least some experience with some staging depoyments of commonsbooking 2.8.5. One with a similar data environment, with 100+ items and also multiple thousand bookings. The update of the indices went smooth and site was functional! |
Beta Was this translation helpful? Give feedback.
-
@derDieDasJojo If you want, it's possible to contact us via commomsonbooking.org and you can share more info that you consider private (your setup/config or your website), which you maybe won't share here in public. |
Beta Was this translation helpful? Give feedback.
-
I can partly confirm the problem (100 items and 4000 bookings leading to some operations being very slow) on a Wordpress installation which was setup several years ago (hoster: all-inkl.com) and still had only isamDb tables rather than innoDB tables. The same test with 4000 bookins and 100 items on another setup (fresh WP installation on the smallest available Strato vServer) was MUCH faster even with the default configuration and no special plugin for creating indices. BTW: Please continue sharing your findings here and not only in private (-; I'm still very interested. |
Beta Was this translation helpful? Give feedback.
-
I just converted this to a discussion because I also have a lot to say about this :) I am currently in the process of migrating an instance with 300 item & locations & timeframes as well as 80.000 bookings. The performance is not great and I am trying to figure out the issues. Running the aforementioned plugins did not work. The main problem is with the cb_items_table shortcode. The issue there is, that the way this table is created is very inefficient. Every single cell in this table corresponds to one database call. The surroounding query functions and each row of the table are cached but when it is first built every morning it can take around 20 minutes for this specific instance. One way to improve performance imo would definitely to do some work in the Calendar::renderItemLocationRow and Calendar::getCalendarDataArray . I have created a branch called experiment/queries-test where you can test the performance of this uncached shortcode using the wp-cli command "table". So you can create a testing enviroment which has a lot of data and try running the wp table command. It will output how long each row of the table takes to render fully. It will clear the cache beforehand but not during the table creation process so it should be an accurate representation of what happens when you render the table each morning. |
Beta Was this translation helpful? Give feedback.
-
What I think also might have an impact: The commonsbooking/src/Repository/Timeframe.php Line 176 in f5d0a32 commonsbooking/src/Repository/Timeframe.php Line 275 in f5d0a32 |
Beta Was this translation helpful? Give feedback.
-
So, I've just created a script on the aformentioned testing enviroment that allow you to create a bunch of test data to run performance tests. I usually use wp-env for this, since the wp-env clean all command allows me to re-build the entire enviroment if I want to. So what you can now do to test the performance (and also install some shortcodes to view)
Or just run the new "wp flood" and "wp table" command in your own testing enviroment. What I think is also noteworthy here is, that this enviroment does not have any current bookings but is just slowed down by old bookings that should no longer be relevant. As of right now, it takes me about 4028.124368 milliseconds to render one row,
Those are the times I am currently averaging, 200 rows for the item table take about 13 minutes which is less than ideal. Oh, also wp-env seems to have an issue with the /tmp/ directory, so I just create a cache directory in the root folder of the plugin and give it 777 permissions and point the cache directory (in advanced settings of the plugin) to /srv/http/www/wp-content/plugins/commonsbooking/cache EDIT: wp-env has some Caching issues for me so maybe you are better off with just running it on a regular site. |
Beta Was this translation helpful? Give feedback.
-
If someone still follows this thread, hans and I had a discussion about cron jobs (system scheduler), an experimental branch of an alternative solution and its SQL table indicies here: #1679 I am still interested in progress/opinions/data from everyone else. |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
We are using commonsbooking to manage around 100 things and have around 4000 bookins (within the last years).
The website is having more and more timeouts especially when changing bookings via the admin Interface.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There should be no timeouts using commonsbooking and commonsbooking should respond significantly faster.
Research & Assumptions
I did a little research in the Code an in the Database. And as far as I can see every single booking is a new post.
The problem with posts in wordpress is, that only the main information are stored in the table
wp_posts
and all additional information including that for commonsbooking are stored in the tablewp_postmeta
. This table does not have a seperate column for every kind of metadata but instead uses a only the three columnspost_id
,meta_key
,meta_value
. So one booking contains several entries of inwp_postmeta
. And the columnmeta_value
does not even have an index. This means that searching for an booking with an certain date of return makes it necessary for mysql to look at every entry (of this meta_type) in the tableẁp_postmeta
. This datastructure seems to be the root problem of the performance challenges in commonsbooking.Possible Solutions
I think the best solution would be to migrate all relevant (additional) information about a booking to an own table eg.
wp_cb_booking
and add indices to all columns the system could possibly need to search for.As a first measure of mitigation it could possibly also help to add indices to the column
meta_key
ofwp_postmeta
.Beta Was this translation helpful? Give feedback.
All reactions