I currently have throttling set to 50 page loads in 10 seconds, but 8 page refreshes causes a lockout. Does throttling count each snippet & embed? The docs on throttling are very limited.
Thanks,
Paul
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
January 11, 2012 5:52am
Subscribe [2]#1 / Jan 11, 2012 5:52am
I currently have throttling set to 50 page loads in 10 seconds, but 8 page refreshes causes a lockout. Does throttling count each snippet & embed? The docs on throttling are very limited.
Thanks,
Paul
#2 / Jan 12, 2012 5:53pm
Hi Paul,
We did some testing, and it doesn’t appear that ExpressionEngine counts snippets and embeds as part of metric for throttling. However, I am going to run this up to the devs for clarification.
Thanks!
#3 / Jan 12, 2012 6:02pm
Thanks. Did you find it looked you out before reaching the set amount of page loads?
#4 / Jan 12, 2012 6:15pm
Hey Paul,
Sorry, I forgot to include that. No, in our testing the lockout only occurred after the threshold had been reached. if you are interested, you can monitor activity on exp_throttle in the database.
Cheers!
#5 / Jan 13, 2012 5:31pm
Hrm… let’s see if we can get a bit more info. Go to ‘Admin- System Prefs- Output and debug’ and turn ‘Display Output Profiler?’ on. Then reload the page in question on the frontend and just do a page search for ‘throttle’- let’s see if it’s hitting the db more than once a load. Or… if there’s something about the ip that might be shared.
Note- look for ’ DATABASE: g20 QUERIES: 29’ (number/name will differ)- you’ll likely have to click ‘show’- and then search page and see what you get. Only refs I have are:
0.0004 SELECT hits, locked_out, last_activity FROM exp_throttle WHERE ip_address= ‘127.0.0.1’
0.0006 UPDATE exp_throttle SET hits = ‘1’, last_activity = ‘1326494026’, locked_out = ‘n’ WHERE ip_address= ‘127.0.0.1’
Let’s see if that gives us a hint.
#6 / Jan 14, 2012 3:11pm
Hi Robin
Here’s what I’ve got for two attempts, looks fine:
UPDATE exp_throttle SET hits = '1', last_activity = '1326570848', locked_out = 'n' WHERE ip_address= ''
UPDATE exp_throttle SET hits = '1', last_activity = '1326570907', locked_out = 'n' WHERE ip_address= ''I even set throttling to 2 page loads in 30 secs and couldn’t get it to lock me out.
Then I remembered that I’d just set
$config['enable_db_caching'] = "y";in config.php
So I set it back to ‘n’, and original throttle settings, and it locked me out after 10 page loads, similar to before. The debugging code showed:
0.0004 SELECT hits, locked_out, last_activity FROM exp_throttle WHERE ip_address= ''
0.0003 UPDATE exp_throttle SET hits = '35', last_activity = '1326571628', locked_out = 'n' WHERE ip_address= ''I’ll look at the DB details after dinner. But it does bring up another issue. It seems that throttling doesn’t work if this is set:
$config['enable_db_caching'] = "y";#7 / Jan 14, 2012 3:14pm
Actually just spotted the number of hits is a lot higher so I waited for the time limit to expire - hits should now be 0, and loaded.
First time was SET hits = ‘5’, then 10, then 15, etc. Up by 5 each time.
#8 / Jan 14, 2012 5:31pm
Okay, here’s what I’ve done.
1. Truncate the exp_throttle table.
2. Reload a page.
0.0003 SELECT hits, locked_out, last_activity FROM exp_throttle WHERE ip_address= ''
0.0002 INSERT INTO exp_throttle (ip_address, last_activity, hits) VALUES ('', '1326579849', '1')3. Data in exp_throttle shows one row, with a 5 in the hits column!!
#9 / Jan 16, 2012 4:21pm
Sorry for the delay, Paul. I’ve been experimenting and can’t reproduce at all. Trying to figure out why the heck it seems to work in increments of 5.
Let’s scale back- create a test template with nothing on it but ‘Test template’- turn throttling on and ‘Display Output Profiler’ on- don’t cache db queries. Hrm- set throttle to say
Maximum Number of Page Loads - 10
Time Interval (in seconds) - 2
Lockout Time (in seconds) - 10
Load template- look for that ‘set throttle’ query. Then just reload the page- it SHOULD just increment by 1. Reload- increment by 1. Etc. With 10 loads in 2 seconds, I don’t expect you to ever trigger throttling doing it manually. Let’s just see how it increments. And it should be resetting that increment every 2 seconds- I think the highest I got it to up to was 4-5 hits before it would reset (due to the 2 second time interval).
What’s it doing in that test environment?
#10 / Jan 25, 2012 8:23am
In the test template it works as expected. I’ll try adding various things (snippets, variables, etc) one at a time to see where the problem may lie.
#11 / Jan 25, 2012 8:27am
Okay, I’ve added a snippet that contains a Safecracker form and now the test template is incrementing the throttle by 2s. Now I’ll try with an empty snippet.
#12 / Jan 25, 2012 8:28am
Changing to an empty snippet causes it to go back to correctly incrementing in 1s.
#13 / Jan 25, 2012 8:41am
I’ve placed the Safecracker form directly into the template, and am still getting throttling incrementing in 2s. So I’m gradually removing parts of the form to see if it’s something in there.
Embeds removed - not fixed
Custom fields loop removed - not fixed
Categories removed - not fixed
Everything removed from between Safecracker tags - not fixed
The test template now still increases throttling by 2s but consists of only:
{exp:safecracker channel="venues" include_jquery="no"}{/exp:safecracker}If I reduce the code even further it changes to increasing by 5s:
{exp:safecracker channel="venues"}{/exp:safecracker}
#14 / Jan 25, 2012 8:46am
On my original template that was having the throttling problems I’ve removed the snippet that contained the Safecracker form and throttling is correctly incrementing by 1s.
#15 / Jan 25, 2012 12:08pm
Hrm- I have a suspicion on why it may be happening, but need to do a bit of code diving. I really appreciate the extensive debug you’ve done here, Paul. SC would not have occurred to me as the source of the throttling count jumps.