Loading pages is very slow, it can take more than 30 seconds, it's very bad for user behavior.
This information from postgresql.log with log_min_duration_statement.
Duration: 2101.420 milliseconds: SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = $1 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET $2 LIMIT $3
jforum=> EXPLAIN SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = 18719 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET 18040 LIMIT 20;
-[ RECORD 1 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Limit (cost=105610.64..105610.64 rows=1 width=633)
-[ RECORD 2 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Sort (cost=105572.43..105610.64 rows=15285 width=633)
-[ RECORD 3 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Sort Key: p.post_time
-[ RECORD 4 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash Join (cost=14278.87..100173.63 rows=15285 width=633)
-[ RECORD 5 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Hash Cond: (p.user_id = u.user_id)
-[ RECORD 6 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash Join (cost=13487.28..99076.34 rows=15285 width=619)
-[ RECORD 7 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Hash Cond: (pt.post_id = p.post_id)
-[ RECORD 8 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_posts_text pt (cost=0.00..76023.87 rows=752987 width=547)
-[ RECORD 9 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash (cost=13271.80..13271.80 rows=17238 width=76)
-[ RECORD 10 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Heap Scan on jforum_posts p (cost=574.02..13271.80 rows=17238 width=76)
-[ RECORD 11 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Recheck Cond: (topic_id = 18719)
-[ RECORD 12 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: (need_moderate = 0)
-[ RECORD 13 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Index Scan on idx_posts_topic (cost=0.00..569.71 rows=17238 width=0)
-[ RECORD 14 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (topic_id = 18719)
-[ RECORD 15 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash (cost=636.82..636.82 rows=12382 width=18)
-[ RECORD 16 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_users u (cost=0.00..636.82 rows=12382 width=18)
Indexes and query rewriting can significantly speed up:
CREATE INDEX idx_posts_text ON jforum_posts_text(post_id);
jforum=> EXPLAIN SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = 18719 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET 18040 LIMIT 20;
-[ RECORD 1 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Limit (cost=98976.52..98976.52 rows=1 width=633)
-[ RECORD 2 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Sort (cost=98933.43..98976.52 rows=17238 width=633)
-[ RECORD 3 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Sort Key: p.post_time
-[ RECORD 4 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash Join (cost=1366.04..92827.45 rows=17238 width=633)
-[ RECORD 5 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Hash Cond: (p.user_id = u.user_id)
-[ RECORD 6 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Nested Loop (cost=574.44..91691.09 rows=17238 width=619)
-[ RECORD 7 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Heap Scan on jforum_posts p (cost=574.02..13271.80 rows=17238 width=76)
-[ RECORD 8 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Recheck Cond: (topic_id = 18719)
-[ RECORD 9 ]-------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: (need_moderate = 0)
-[ RECORD 10 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Index Scan on idx_posts_topic (cost=0.00..569.71 rows=17238 width=0)
-[ RECORD 11 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (topic_id = 18719)
-[ RECORD 12 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Index Scan using idx_posts_text on jforum_posts_text pt (cost=0.42..4.54 rows=1 width=547)
-[ RECORD 13 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (post_id = p.post_id)
-[ RECORD 14 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash (cost=636.82..636.82 rows=12382 width=18)
-[ RECORD 15 ]------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_users u (cost=0.00..636.82 rows=12382 width=18)
Duration: 7404.819 milliseconds: SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = $1 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET $2 LIMIT $3
jforum=> EXPLAIN SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = 19123 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET 22000 LIMIT 20;
-[ RECORD 1 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Limit (cost=106808.61..106808.61 rows=1 width=633)
-[ RECORD 2 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Sort (cost=106753.69..106808.61 rows=21965 width=633)
-[ RECORD 3 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Sort Key: p.post_time
-[ RECORD 4 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash Join (cost=13861.10..98936.20 rows=21965 width=633)
-[ RECORD 5 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Hash Cond: (p.user_id = u.user_id)
-[ RECORD 6 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash Join (cost=13069.51..97705.30 rows=21965 width=619)
-[ RECORD 7 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | Hash Cond: (pt.post_id = p.post_id)
-[ RECORD 8 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_posts_text pt (cost=0.00..76985.81 rows=849181 width=547)
-[ RECORD 9 ]----------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash (cost=12794.95..12794.95 rows=21965 width=76)
-[ RECORD 10 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Heap Scan on jforum_posts p (cost=414.65..12794.95 rows=21965 width=76)
-[ RECORD 11 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Recheck Cond: (topic_id = 19123)
-[ RECORD 12 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: (need_moderate = 0)
-[ RECORD 13 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Bitmap Index Scan on idx_posts_topic (cost=0.00..409.16 rows=21965 width=0)
-[ RECORD 14 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (topic_id = 19123)
-[ RECORD 15 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Hash (cost=636.82..636.82 rows=12382 width=18)
-[ RECORD 16 ]---------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_users u (cost=0.00..636.82 rows=12382 width=18)
Duration: 29986.836 milliseconds: SELECT t.*, p.user_id AS last_user_id, p.post_time, p.post_edit_time, (SELECT SUM(p.attach) FROM jforum_posts p WHERE p.topic_id = t.topic_id AND p.need_moderate = 0) AS attach FROM jforum_topics t, jforum_posts p WHERE (t.forum_id = $1 OR t.topic_moved_id = $2) AND p.post_id = t.topic_last_post_id AND p.need_moderate = 0 ORDER BY t.topic_type DESC, (CASE WHEN t.topic_type=3 AND p.post_edit_time IS NOT NULL THEN p.post_edit_time ELSE p.post_time END) DESC OFFSET $3 LIMIT $4
jforum=> EXPLAIN SELECT t.*, p.user_id AS last_user_id, p.post_time, p.post_edit_time, (SELECT SUM(p.attach) FROM jforum_posts p WHERE p.topic_id = t.topic_id AND p.need_moderate = 0) AS attach FROM jforum_topics t, jforum_posts p WHERE (t.forum_id = 1 OR t.topic_moved_id = 1) AND p.post_id = t.topic_last_post_id AND p.need_moderate = 0 ORDER BY t.topic_type DESC, (CASE WHEN t.topic_type=3 AND p.post_edit_time IS NOT NULL THEN p.post_edit_time ELSE p.post_time END) DESC OFFSET 0 LIMIT 50;
-[ RECORD 1 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Limit (cost=2639300.61..2639300.73 rows=50 width=135)
-[ RECORD 2 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Sort (cost=2639300.61..2639317.83 rows=6889 width=135)
-[ RECORD 3 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Sort Key: t.topic_type, (CASE WHEN ((t.topic_type = 3) AND (p.post_edit_time IS NOT NULL)) THEN p.post_edit_time ELSE p.post_time END)
-[ RECORD 4 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Nested Loop (cost=0.42..2639071.76 rows=6889 width=135)
-[ RECORD 5 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Seq Scan on jforum_topics t (cost=0.00..880.75 rows=6889 width=115)
-[ RECORD 6 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: ((forum_id = 1) OR (topic_moved_id = 1))
-[ RECORD 7 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Index Scan using idx_posts_idx on jforum_posts p (cost=0.42..4.90 rows=1 width=24)
-[ RECORD 8 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (post_id = t.topic_last_post_id)
-[ RECORD 9 ]----------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: (need_moderate = 0)
-[ RECORD 10 ]---------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | SubPlan 1
-[ RECORD 11 ]---------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Aggregate (cost=378.03..378.04 rows=1 width=4)
-[ RECORD 12 ]---------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | -> Index Scan using idx_posts_topic on jforum_posts p_1 (cost=0.42..377.75 rows=113 width=4)
-[ RECORD 13 ]---------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Index Cond: (topic_id = t.topic_id)
-[ RECORD 14 ]---------------------------------------------------------------------------------------------------------------------------------------------
QUERY PLAN | Filter: (need_moderate = 0)
Thanks for the analysis, and sorry for being slow to get back to you. I'm not clear on the connection between the proposed index you mentioned (CREATE INDEX idx_posts_text ON jforum_posts_text(post_id)) and the various slow queries: are all those improved by that new index? Or just the first one?
Just the first one. The last two queries do not use the index but use a sequential scan.
The new index idx_posts_text ON jforum_posts_text(post_id) did not give any increase in perfomance
Duration: 10923.789 milliseconds: SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = $1 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET $2 LIMIT $3
EXPLAIN ANALYZE SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = 19923 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET 21400 LIMIT 20;
Duration: 18211.708 milliseconds: SELECT t.*, p.user_id AS last_user_id, p.post_time, p.post_edit_time, (SELECT SUM(p.attach) FROM jforum_posts p WHERE p.topic_id = t.topic_id AND p.need_moderate = 0) AS attach FROM jforum_topics t, jforum_posts p WHERE (t.forum_id = $1 OR t.topic_moved_id = $2) AND p.post_id = t.topic_last_post_id AND p.need_moderate = 0 ORDER BY t.topic_type DESC, (CASE WHEN t.topic_type=3 AND p.post_edit_time IS NOT NULL THEN p.post_edit_time ELSE p.post_time END) DESC OFFSET $3 LIMIT $4
EXPLAIN ANALYZE SELECT t.*, p.user_id AS last_user_id, p.post_time, p.post_edit_time, (SELECT SUM(p.attach) FROM jforum_posts p WHERE p.topic_id = t.topic_id AND p.need_moderate = 0) AS attach FROM jforum_topics t, jforum_posts p WHERE (t.forum_id = 1 OR t.topic_moved_id = 1) AND p.post_id = t.topic_last_post_id AND p.need_moderate = 0 ORDER BY t.topic_type DESC, (CASE WHEN t.topic_type=3 AND p.post_edit_time IS NOT NULL THEN p.post_edit_time ELSE p.post_time END) DESC OFFSET 0 LIMIT 50;
First query plan
OK, I'll remove it. Should have tested it more than I did.
Perfomance problem in nested loops. I tried to rewrite the queries by adding subquery. Perhaps this is not the best solution, but it does not require changing one line of Java code. In PostModel.selectAllByTopicByLimit perfomance has increased approximately 8 times on the cold cache datebase right after start.
In PostModel.selectByUserByLimit perfomance has increased approximately 13 times. As for this query, jforum_topics struct have not information about topic last changing, order by topic_last_post_id not good solution.
And maybe PostModel.selectByUserByLimit and TopicModel.selectByUserByLimit need additional perfomance testing.
EXPLAIN ANALYZE SELECT p.post_id, topic_id, forum_id, p.user_id, post_time, poster_ip, enable_bbcode, p.attach, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count, status, pt.post_subject, pt.post_text, username, p.need_moderate, u.user_viewonline FROM jforum_posts p, jforum_posts_text pt, jforum_users u WHERE p.post_id = pt.post_id AND topic_id = 19923 AND p.user_id = u.user_id AND p.need_moderate = 0 ORDER BY post_time ASC OFFSET 21400 LIMIT 20;
Limit (cost=2888942.89..2888943.02 rows=50 width=139) (actual time=32993.151..32993.173 rows=50 loops=1)
-> Sort (cost=2888942.89..2888960.10 rows=6883 width=139) (actual time=32993.148..32993.153 rows=50 loops=1)
Sort Key: t.topic_type, (CASE WHEN ((t.topic_type = 3) AND (p.post_edit_time IS NOT NULL)) THEN p.post_edit_time ELSE p.post_time END)
Sort Method: top-N heapsort Memory: 38kB
-> Nested Loop (cost=140.07..2888714.25 rows=6883 width=139) (actual time=292.663..32956.099 rows=6883 loops=1)
-> Bitmap Heap Scan on jforum_topics t (cost=139.65..758.89 rows=6883 width=119) (actual time=29.563..46.481 rows=6883 loops=1)
Recheck Cond: ((forum_id = 1) OR (topic_moved_id = 1))
Heap Blocks: exact=415
-> BitmapOr (cost=139.65..139.65 rows=6883 width=0) (actual time=29.386..29.386 rows=0 loops=1)
-> Bitmap Index Scan on idx_topics_forum (cost=0.00..131.91 rows=6883 width=0) (actual time=17.728..17.728 rows=6885 loops=1)
Index Cond: (forum_id = 1)
-> Bitmap Index Scan on idx_topics_moved (cost=0.00..4.29 rows=1 width=0) (actual time=11.653..11.653 rows=0 loops=1)
Index Cond: (topic_moved_id = 1)
-> Index Scan using jforum_posts_pkey on jforum_posts p (cost=0.42..4.87 rows=1 width=24) (actual time=1.384..1.389 rows=1 loops=6883)
Index Cond: (post_id = t.topic_last_post_id)
Filter: (need_moderate = 0)
SubPlan 1
-> Aggregate (cost=414.68..414.69 rows=1 width=4) (actual time=3.385..3.385 rows=1 loops=6883)
-> Bitmap Heap Scan on jforum_posts p_1 (cost=5.28..414.41 rows=110 width=4) (actual time=0.291..3.366 rows=52 loops=6883)
Recheck Cond: (topic_id = t.topic_id)
Filter: (need_moderate = 0)
Heap Blocks: exact=81760
-> Bitmap Index Scan on idx_posts_topic (cost=0.00..5.25 rows=110 width=0) (actual time=0.211..0.211 rows=52 loops=6883)
Index Cond: (topic_id = t.topic_id)
Planning time: 263.312 ms
Execution time: 33016.868 ms
~~~
EXPLAIN ANALYZE SELECT t.*, p.user_id AS last_user_id, p.post_time, p.post_edit_time, (SELECT SUM(p.attach) FROM jforum_posts p WHERE p.topic_id = t.topic_id AND p.need_moderate = 0) AS attach FROM jforum_topics t, jforum_posts p WHERE p.post_id IN (SELECT t.topic_last_post_id FROM jforum_topics t WHERE (t.forum_id = 1 OR t.topic_moved_id = 1) ORDER BY t.topic_last_post_id DESC OFFSET 0 LIMIT 50) AND p.post_id = t.topic_last_post_id AND p.need_moderate = 0 ORDER BY t.topic_type DESC, (CASE WHEN t.topic_type=0 AND p.post_edit_time IS NOT NULL THEN p.post_edit_time ELSE p.post_time END) DESC;
Thanks, that's good stuff. I'll take this up when I next dabble with JForum. That's going to be some time, but it'll make it into the next release.
I've applied the patch to PostModel.selectAllByTopicByLimit and TopicModel.selectAllByForumByLimit, and a similiar one to PostModel.selectByUserByLimit, both for the generic SQL and the Postgres-specific SQL. Let me know if they do the job for you (while EXPLAIN indicates it works, my test DB is too small to see it in action).
Just FYI, these changes are not supported by MySQL and prevent the topics from being viewed. I opened a separate ticket before I found this one.
Thanks for reporting that. I've undone the changes for DBs other than Postgres. Unreleased changes do not always get the amount of testing that a release version would :-/
Thanks, PostModel.selectAllByTopicByLimit and TopicModel.selectAllByForumByLimit work good. But TopicModel.selectRecentTopicsByLimit and TopicModel.selectHottestTopicsByLimit requests need additional optimization. And for net.jforum.dao.PostDAO#selectAllByTopic use LIMIT Integer.MAX_VALUE - 1 is a bad idea, on big topics query execution time 2 minutes.
I added the optimized PostgreSQL queries.
As to not using Integer.MAX_VALUE, I went a different route that uses SQL without the LIMIT - it should have the same effect. Hardcoding limits on how many posts per topic there can be, or how many topics per forum causes peroblem that would require substantial workarounds.
Last edit: Ulf Dittmer 2018-09-25
These changes in src/main/java/net/jforum/dao/generic/GenericTopicDAO.java cause NullPointerException
line 116-117
src/main/java/net/jforum/repository/PostRepository.java
PostDAO pm = DataAccessDriver.getInstance().newPostDAO();
posts = pm.selectAllByTopic(topicId);
if set 100 like in my patch this.selectAllByForumByLimit(forumId, 0, 100) forum work quick without freezes, but posts.cache need be disable, otherwise the posts bigger 100 are not loaded; topic.cache.enabled = true and posts.cache.enabled = false
I have long suspected that the topic/post cache is dodgy. Way back when JForum was introduced at CodeRanch, I remember us disabling the caches due to some bug. I'll look into what's involved to make them work, but possibly the solution is to disable them permanently.
I'm trying to repoduce the problem. With the code as it is now in the repo, and topic.cache.enabled = true and posts.cache.enabled = false, a topic with more than 100 posts will cause the exception - is that correct?
Right. With the code as it is now in the repo (r666)
If topic.cache.enabled = true arises forums/show NullPointerException
If posts.cache.enabled = true arises posts/list NullPointerException
If topic.cache.enabled = true and posts.cache.enabled = true arises forums/show NullPointerException and posts/list NullPointerException
If topic.cache.enabled = false and posts.cache.enabled = false all work ...
It all NOT depends on the number of posts.
About topic with more than 100 posts concerns my experiments with changes return this.selectAllByTopicByLimit(topicId, 0, 100); in net.jforum.dao.PostDAO#selectAllByTopic
If change: forum work quick without freezes, but the posts in topic bigger 100 are not loaded.
If not change: in big topic (for example 15000 posts in topic) forum freeze, page can load 2 minutes and bigger. This beecause query with huge limit (Integer.MAX_VALUE - 1).
To add:
topic.cache.enabled = true before commit [r664] work good and no freeze forum.
freeze and sloooooow load only posts.cache.enabled = true on big topics
Related
Commit: [r664]
That's quite odd. I'm testing with both caches enabled and all works fine. There must be additional conditions for the errors to manifest.
I also tested with either one turned on and the other one off - all is fine.
This is with the EhCache engine.
Last edit: Ulf Dittmer 2018-09-27
Which cache engine are you using?
Sorry about that. I try re-install forum and can not reproduce problem. All is fine, on mysql and postgres.
Recursive diff between old working copy show difference csrfguard.properties, jforum-custom.conf, language and templates perhaps it arises NullPointerException.
Problem with posts.cache.enabled = true stiil remains on big topic, forum freeze, page load slow.
I tried to optimize another query and big topic with posts.cache.enabled = true worked quick.
OK, I've added that optimized query.
That should be taken care of when using the latest version from the repository, no?