-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CDbHttpSession: garbage collection probability cannot be set low enough #486
Comments
Hi, Thanks for doing this. Using a float is a great idea. Should be tolerable backwards compat. I will be glad to try to test but I have a couple of suggestions first. First, bumping the divisor up to 100000 seems a little arbitrary to me. If Yii offers the user a float for $gCProbability, why not allow as much range as possible? So I would suggest maybe using 2147483647 as divisor (or even PHP_INT_MAX, I'm not sure). Also, since there's no reason to believe that this VA is set before it is gotten (or that something else manipulates these php config vars) I think it would be safer for the getter to return something along the lines of:
Let me know what you think. |
I think the value 2147483647 would be enough for any case and any situation user can have. And fixed value (2.1*10^9) would be better than PHP_INT_MAX because the latter is different across various platforms and architectures.
That makes sense. Thanks! Will fix it soon. |
@tom-- I'm done. |
…ttps://github.com/resurtm/yii into resurtm-486-http-session-gc-probability * '486-http-session-gc-probability' of https://github.com/resurtm/yii: Refinements and $gCProbability now can be 0.00000005% not just a 0.001%. Enh #486: CHttpSession::$gCProbability and CDbHttpSession::$gCProbability are floats now. Minimal $gCProbability value has been changed to the 0.001%, was 1% before, default value left unchanged (1%). Conflicts: CHANGELOG
@tom-- So, fix was merged into upstream. Did you tried it? |
@resurtm not yet. the testing is going to require some sophistication and to estimate the probability will need statistical sampling and many runs. plus i should figure out first how to write a unit test that i can create a PR for. this week, i hope. |
as for the PR for the unit test, it's probably no different than any other, yes? |
@tom-- Okay. I'm also testing this issue. |
@tom-- Yes, the process completely same. |
should i include in one PR the new CTestCase script file and fixes to CHttpSession.php so that it passes the new tests? |
@tom-- yes, sure. That's ok. |
i added github code comments to the PRs diff view: #1309 |
…tion * master: (180 commits) Updated changelog with last-modified date change. Changed the CHttpCacheFilter to use RFC 1123 complaint dates when returning the last-modified header. tabs... gii: better default validation "length" rule for fixed-point / floating-point field type (MYSQL) fixes yiisoft#1319 updated comment in CHttpSession Update framework/YiiBase.php Update docs/guide/database.arr.txt New unit test for enhanced $gCProbability s/getters in CHttpSession yiisoft#486. Fixed those methods to process corner cases properly. Initial $gCProbability is now double(1.0), was > 1.0 before. Bug yiisoft#112: MSSQL: database abstraction layer now uses native transaction support of the SQLSRV driver. Forgot about spaces in comments creating procedure call. [ci skip] Better comments testing method name. Forgot about local MSSQL database settings. MSSQL unit testing SQL file reformatted and decorated. MSSQL testing class improved. Added unit tests for column comments retrieving. Removed old message. Update docs/guide/topics.i18n.txt Update docs/guide/topics.i18n.txt Requirements checker: russian (ru_RU) messages. Minor fixes and refinements to the MSSQL unit tests. better fix for issues yiisoft#124 ... Conflicts: UPGRADE
CDbHttpSession's configuration allows a minimum GC probability of 1%.
if a server is handling, e.g., 1000 requests a second, that means it runs GC 10 times a second. that's wasteful. in many cases once a minute would be sufficient so this minimum constraint could be off by two or three orders of magnitude.
suggest allowing the configuration of PHP's GC denominator.
The text was updated successfully, but these errors were encountered: