Hello,
I'm getting a lot of alerts over the last 24 hours from Digital Ocean that CPU usage is running high.
Sorry if things are running slow for anyone. We may eventually need to move to a larger virtual server. I will continue to monitor.
Peter
Website issues
Re: Website issues
I can suggest doing some steps for this:
1. You can enable file cache for zxImage library, this will save a lot of CPU resources.
2. Profiling SQL requests to find the slowest ones and setting up appropriate indexes would help a lot.
3. You can also set up some data-caching for the heaviest SQL requests: if some popular SQL request cannot be improved further by indexes, you can serialize it and put it into file system (or Redis if it's available on your hosting) for some hours or even days.
4. You can cache the whole HTML responses, that would be the most efficient. Use output buffering to gather a response, make some hash from request uri and save the response with the name of this hash. Next time you get such request uri, just take an HTML from cache and serve it to user or invalidate the cache if it's too old.
1. You can enable file cache for zxImage library, this will save a lot of CPU resources.
2. Profiling SQL requests to find the slowest ones and setting up appropriate indexes would help a lot.
3. You can also set up some data-caching for the heaviest SQL requests: if some popular SQL request cannot be improved further by indexes, you can serialize it and put it into file system (or Redis if it's available on your hosting) for some hours or even days.
4. You can cache the whole HTML responses, that would be the most efficient. Use output buffering to gather a response, make some hash from request uri and save the response with the name of this hash. Next time you get such request uri, just take an HTML from cache and serve it to user or invalidate the cache if it's too old.
- Ast A. Moore
- Rick Dangerous
- Posts: 2640
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Website issues
Haven’t noticed any slowdown on my end. Granted, I rarely used the main site; mostly the forums.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Website issues
For the first suggestion:
$converter is an instance of ZxImage class.
After this all converted images would be automatically stored in the created folder by ZxImage converter. Same converter will also purge the cache automatically from time to time basing on cache file creation dates.
$converter is an instance of ZxImage class.
Code: Select all
//make some folder for file cache
if (!is_dir($folderForCache)) {
mkdir($folderForCache);
}
//set cache path to converter
$converter->setCachePath($folderForCache);
//enable file caching
$converter->setCacheEnabled(true);
- Einar Saukas
- Bugaboo
- Posts: 3070
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Website issues
If you can collect query statistics, I will gladly analyze and optimize them for you.moroz1999 wrote: ↑Mon Dec 30, 2019 12:38 pm I can suggest doing some steps for this:
1. You can enable file cache for zxImage library, this will save a lot of CPU resources.
2. Profiling SQL requests to find the slowest ones and setting up appropriate indexes would help a lot.
3. You can also set up some data-caching for the heaviest SQL requests: if some popular SQL request cannot be improved further by indexes, you can serialize it and put it into file system (or Redis if it's available on your hosting) for some hours or even days.
4. You can cache the whole HTML responses, that would be the most efficient. Use output buffering to gather a response, make some hash from request uri and save the response with the name of this hash. Next time you get such request uri, just take an HTML from cache and serve it to user or invalidate the cache if it's too old.
Although I agree that caching (options 1 and 4) are your best bet.
Re: Website issues
I'm using all four suggestions in commercial projects, they are all helpful on their levels
Re: Website issues
Thanks both, I will see what data I can get and will share it with you both.
Peter
Peter
Re: Website issues
Also check if the website machine, was not infected, with some kind of digital money harvesting bot.
It can also be someone exploring the system, like crawling the page and the search features to extract data.
Which is kind of dumb, since the data (ZX-DB) is open and free.
It can also be someone exploring the system, like crawling the page and the search features to extract data.
Which is kind of dumb, since the data (ZX-DB) is open and free.
Re: Website issues
That's actually a nice advise. You can check it this way:
1. Download all files to separate directory
2. Compare it to repository using some bin comparison tool like windiff or beyond compare, this will show quickly any modifications in any scripts.
BTW, are you using 7.4 already? Each PHP update seems to have some real performance improvements in the core, and soon there would be a JIT available as well. You can also try to set up a script preloading list, this would help a lot as well.
But my guess is:
1. ZX images converter needs a file cache enabled, this one is CPU-demanding if done on a fly.
2. SQL requests indexes.