March 1, 2021 10:21 PM - BoerumHillScott
Putting in a big change that I have been working on the last two weeks.
If all goes well, the site should load much faster with no change in functionality.
This is the single biggest change I have made to the site code in almost 6 years, and I expect at least some bugs.
Due to the nature of the changes, the most common bugs will probably be items not refreshing as expected.
If all goes well, the site should load much faster with no change in functionality.
This is the single biggest change I have made to the site code in almost 6 years, and I expect at least some bugs.
Due to the nature of the changes, the most common bugs will probably be items not refreshing as expected.
Edited by BoerumHillScott at March 2, 2021 12:13 AM
9 comments
Initial refresh testing of how long it take the server to process a page, and how long the total time from hitting refresh to getting the page to my computer (times in milliseconds) :
Home page was 157 ms/ 295 ms, now 17ms / 53 ms
Monday OT was 296 ms /411 ms, now 20 ms / 58 ms
Tech stuff regarding changes below:
Pretty much everything thing you see on the site that is not an image is stored in a relational database (originally MySQL, now MariaDB)
Relational databases are great at storing and retrieving complicated data in a way that let you combine different components in a logical manner, but they are also relatively slow.
What I did was put an in-memory key-value store (Redis) in front of the database to serve as cache for most reads, so that once the data is pulled from the database once, all future reads from from the cache.
For components that have not changed since the last read, the site is much faster.
When something is written (new post, new comment, etc), the impacted parts of the cache are deleted, and re-created on the next read.
If I did everything right, the worst case is that writes and reads immediately after writes take 110% of they time they did before, and the best case is that all other reads take 10% of the time they did before.
The list of groups on the right side should be sorted by most recent post, but since that list is in the cache and was not reset when the Tuesday OT was posted, it now shows the wrong order.
Will be easy to fix.
I also put in a box at the bottom of the home page and group pages to make it easy to jump to a specific page.
Looks like it screwed up the "new post" markers.