-
Notifications
You must be signed in to change notification settings - Fork 297
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
High memory usage on save operations with ~23000 bookmarks #2032
Comments
I think that's your problem right there. How big is your datastore.php file? |
6.42 MB. I've been bookmarking stuff for a long, long time. If I read the BookmarkIO.php code correctly, the entire datastore gets read into memory each time a link is added? IDK how best to solve this, but maybe splitting the datastore once it reaches a problematic size would help? I appreciate your attention, thanks very much. |
Correct.
This would (probably?) not be an easy fix, and would add complexity to a critical part of the program (saving data), when a simple configuration fix exists (increase PHP max allowed memory size). 134217728 + 21128048 = 155345776 bytes = ~148MiB. That doesn't seem excessive at all for 23k bookmarks :) Especially considering this amount is only used on save operations. I'm in favor of simply documenting the fix for this error ( Using PHP-FPM this is controlled by the directive |
So... I increased memory_limit all the way to 1024M, and I'm still getting the same error. Either something in the PHP stack is lying to me, or something's gone wrong with Shaarli's memory use. Any suggestions on how I might tell the difference? |
<?php
phpinfo(); |
@dsalo hi, any updates? |
Ope, sorry! Not yet -- I finagled the error by deleting a few hundred of my oldest/404est bookmarks, so it may be a few weeks/months before I trigger it again. What I remember, though, is that the error message I got was identical to the one I quoted in my initial report. (Future-dev suggestion: a 404-hunting tool would be awfully nice, especially if it played nicely with the "look it up on Wayback" function, which is awesome by the way. There are a couple of add-ons that supposedly do it, but they're pretty old and I'm not sure they work with current Shaarli.) I can get the phpinfo() for you, though: |
Thanks;
We could create a script that populates a test instance with hundreds of thousand of bookmarks using the REST API, and check memory usage as the datastore grows, I think it would provide a useful benchmark. Anyway raising the PHP memory limit should work, I will make a note to document this in https://shaarli.readthedocs.io/en/master/Troubleshooting.html
#1816 has a solution that uses a third-party tool I wrote. Let me know in that issue if you find any bugs or need assistance. |
Terrific, thanks much! |
…es exhausted - fixes shaarli#2032
I can't save a bookmark to my Shaarli at linkspam.dsalo.info because it blitzes the 128M of memory designated in php.ini. I'm working on raising that (I need my webhost to restart Apache; I don't have the privs to), but in the meantime -- could this be a less memory-intensive task?
Possible complicating factor: I have almost 23,000 bookmarks.
Error message on save: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 21128048 bytes) in /home/dsaloinf/linkspam/application/bookmark/BookmarkIO.php on line 124
Please let me know if there's more information I can usefully give you.
The text was updated successfully, but these errors were encountered: