Is there a way to cache queries?
Is there a way to cache queries?
Hi. I'm trying to tweak my client's Phoenix Cart 1.1.0.6 setup to lessen the load on the server CPU. Right now high CPU usage seems to be triggering 503 errors due to exceeding the limit.
Is caching queries an option? I would think caching only some queries would work, if it's even possible, since customer-specific info, like what's in their cart, couldn't be cached.
Would the addon Ultimate_SEO_Urls help resolve my issue, since it has a caching system?
Is caching queries an option? I would think caching only some queries would work, if it's even possible, since customer-specific info, like what's in their cart, couldn't be cached.
Would the addon Ultimate_SEO_Urls help resolve my issue, since it has a caching system?
-
BrockleyJohn
- Certified Developer
- Posts: 173
- Joined: Mon Mar 01, 2021 5:37 pm
- Phoenix Version:
- : Buy Me A Beverage
- Has thanked: 2 times
- Been thanked: 30 times
Re: Is there a way to cache queries?
It only caches the urls that it writes, so no it won't help.
First step - make sure that Prevent Spider Sessions is set to True
Update the includes/spiders.txt if not recently done. You can get one here:
https://github.com/BrockleyJohn/spiders
Make sure there's a robots.txt set up and that it has a crawl delay for all of them
First step - make sure that Prevent Spider Sessions is set to True
Update the includes/spiders.txt if not recently done. You can get one here:
https://github.com/BrockleyJohn/spiders
Make sure there's a robots.txt set up and that it has a crawl delay for all of them
Re: Is there a way to cache queries?
Thanks, John, for the suggestions.BrockleyJohn wrote: ↑Fri May 29, 2026 6:28 pm It only caches the urls that it writes, so no it won't help.
First step - make sure that Prevent Spider Sessions is set to True
Update the includes/spiders.txt if not recently done. You can get one here:
https://github.com/BrockleyJohn/spiders
Make sure there's a robots.txt set up and that it has a crawl delay for all of them
Prevent Spider Sessions was already set to true. I've updated spiders.txt.
.htaccess already has this directive:
Code: Select all
User-agent: *
Crawl-delay: 30-
BrockleyJohn
- Certified Developer
- Posts: 173
- Joined: Mon Mar 01, 2021 5:37 pm
- Phoenix Version:
- : Buy Me A Beverage
- Has thanked: 2 times
- Been thanked: 30 times
Re: Is there a way to cache queries?
It should be in robots.txt not .htaccess
You might want to add some disallows while you're at it
(edit) forgot to mention - adjust paths above if shop not in domain root
You might want to add some disallows while you're at it
Code: Select all
User-agent: *
Disallow: /account*
Disallow: /address*
Disallow: /advanced_search*
Disallow: /checkout*
Disallow: /cookie_usage.php
Disallow: /account*
Disallow: /create_account*
Disallow: /login.php
Disallow: /logoff.php
Disallow: /password_forgotten.php
Crawl-delay: 30-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: Is there a way to cache queries?
MySQL (and probably MariaDB) can cache database queries if you turn it on.
Cloudflare can cache page hits if you turn that on. It has a free tier.
In addition to robots.txt, etc.
Cloudflare can cache page hits if you turn that on. It has a free tier.
In addition to robots.txt, etc.
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Is there a way to cache queries?
Check your clients hosting situation. Shared hosting + 503 errors -> almost always a plan limit.
If it's a `bucket` host (GoDaddy, HostGator, etc.) with zillions of sites on every server, your 503 could be someone elses fault entirely.
Get the error logs. If see "worker connections exceeded" or "max_connections," caching might help a bit but won't save you. That's a hosting upgrade conversation.
If it's a `bucket` host (GoDaddy, HostGator, etc.) with zillions of sites on every server, your 503 could be someone elses fault entirely.
Get the error logs. If see "worker connections exceeded" or "max_connections," caching might help a bit but won't save you. That's a hosting upgrade conversation.
Re: Is there a way to cache queries?
My mistake. I meant robots.txt.BrockleyJohn wrote: ↑Fri May 29, 2026 8:07 pm It should be in robots.txt not .htaccess
You might want to add some disallows while you're at it(edit) forgot to mention - adjust paths above if shop not in domain rootCode: Select all
User-agent: * Disallow: /account* Disallow: /address* Disallow: /advanced_search* Disallow: /checkout* Disallow: /cookie_usage.php Disallow: /account* Disallow: /create_account* Disallow: /login.php Disallow: /logoff.php Disallow: /password_forgotten.php Crawl-delay: 30
I've added what you've recommended.
Re: Is there a way to cache queries?
CloudFlare is already caching static files, but not PHP files.
I will inquire from the web host about caching database queries.
Re: Is there a way to cache queries?
The site was on BlueHost, which was trying to sell an expensive upgrade to remedy the 429 error problem. My client hadn't had issues before several months ago.burt wrote: ↑Sun May 31, 2026 9:07 am Check your clients hosting situation. Shared hosting + 503 errors -> almost always a plan limit.
If it's a `bucket` host (GoDaddy, HostGator, etc.) with zillions of sites on every server, your 503 could be someone elses fault entirely.
Get the error logs. If see "worker connections exceeded" or "max_connections," caching might help a bit but won't save you. That's a hosting upgrade conversation.
We've moved to a new web host. On Friday, tech support added two indexes:
Code: Select all
ALTER TABLE `sessions`
ADD PRIMARY KEY (`sesskey`),
ADD KEY `idx_expiry` (`expiry`);
ALTER TABLE `whos_online`
ADD KEY `session_id` (`session_id`),
ADD KEY `idx_time_last_click` (`time_last_click`);I've inquired about MySQL/MariaDB caching the queries.
They do make available Redis, and have said that that would move the session data into memory. I'm hesitant to try that until we've fixed the current problem, since I don't want to make anything worse in the short term.
Re: Is there a way to cache queries?
I went ahead and enabled Redis for sessions in PhoenixCart, and the errors have suddenly stopped.
So on Friday when the web host tech support added two indexes and cleared out stale data, whatever that means, things improved. I repeatedly clicked various categories in the tree, and didn't come up with any errors.
Just now I couldn't do that without ending up with 503 errors. After enabling Redis for sessions in PhoenixCart, I can do that again.
But while it seems to be better, as if sessions are a major problem, I can still trigger some 503 errors by clicking up and down the category list.
So on Friday when the web host tech support added two indexes and cleared out stale data, whatever that means, things improved. I repeatedly clicked various categories in the tree, and didn't come up with any errors.
Just now I couldn't do that without ending up with 503 errors. After enabling Redis for sessions in PhoenixCart, I can do that again.
But while it seems to be better, as if sessions are a major problem, I can still trigger some 503 errors by clicking up and down the category list.