October 13, 2022 02:16PM |
Registered: 21 years ago Posts: 123 |
Hello, I have a long running phorum installation and one topic now has 25,345 posts. Recently users notified me they were getting an error trying to post in the topic.
After investigation, the posting script was running out of memory (PHP memory_limit was 256MB). Further debugging revealed the memory was being consumed by phorum_update_thread_info():
12:48:44 DEBUG update_thread_info before get_messages mem 14.6 MB 49bb296d
12:48:46 DEBUG update_thread_info after get_messages 25348 mem 250.6 MB 49bb296d
The problem is that phorum_update_thread_info() is fetching every message in the thread:
$messages=phorum_db_get_messages($thread,0,1,1);
(Note phorum_api_thread_update_metadata in the latest code seems to operate the same way)
My solution is to modify the function to fetch maybe 100 pages at a time (that topic has 1690 pages) to keep memory usage under control. Does that sound reasonable? You may want to fix this in current code as well.
Thanks
Skye
___
Skye Nott
Corvus Digital
After investigation, the posting script was running out of memory (PHP memory_limit was 256MB). Further debugging revealed the memory was being consumed by phorum_update_thread_info():
12:48:44 DEBUG update_thread_info before get_messages mem 14.6 MB 49bb296d
12:48:46 DEBUG update_thread_info after get_messages 25348 mem 250.6 MB 49bb296d
The problem is that phorum_update_thread_info() is fetching every message in the thread:
$messages=phorum_db_get_messages($thread,0,1,1);
(Note phorum_api_thread_update_metadata in the latest code seems to operate the same way)
My solution is to modify the function to fetch maybe 100 pages at a time (that topic has 1690 pages) to keep memory usage under control. Does that sound reasonable? You may want to fix this in current code as well.
Thanks
Skye
___
Skye Nott
Corvus Digital
October 13, 2022 02:32PM |
Registered: 21 years ago Posts: 123 |
It looks like my version of phorum_db_get_messages() (5.2.15a) does not support fetching a page range, so I think I'll have to temporarily modify $PHORUM['read_length'] in phorum_update_thread_info() in order to chunk the message fetching and restore it before returning. Pretty hacky.
___
Skye Nott
Corvus Digital
___
Skye Nott
Corvus Digital
October 13, 2022 08:54PM |
Registered: 21 years ago Posts: 123 |
Quote
Skye N.
It looks like my version of phorum_db_get_messages() (5.2.15a) does not support fetching a page range, so I think I'll have to temporarily modify $PHORUM['read_length'] in phorum_update_thread_info() in order to chunk the message fetching and restore it before returning. Pretty hacky.
I made this change as described above, setting read_length to 2000 temporarily in phorum_update_thread_info() and iterating, memory usage is down from 250 MB to 76 MB. If you would like the code let me know.
___
Skye Nott
Corvus Digital
Sorry, only registered users may post in this forum.