Discussion Board Design Issue


Web tier: servlets, JSP, Web frameworks: Discussion Board Design Issue

  1. Discussion Board Design Issue (4 messages)

    Hi, I'm trying to write a discussion board (something like what we have here).

    The first page will have, say the latest 20 threads, and there will be links to the next page with the next 20 threads.

    I just have a question about whether to store the messages in memory or not. For example, whenever someone opens up the first page, do I connect to the database and retrieve the first 20 threads? I think that this might be inefficient as many people will access this page, and thus there will be many connections made to the database...

    The other alternative is to keep, say the latest 100 threads as a list in the JSP application object, to save trips to the database. However, this way, I'll have to manage this list and update it whenever someone posts messages...

    Does anyone know of a "standard" way to do this? I would really appreciate any suggestions. Thanks.

    Threaded Messages (4)

  2. Discussion Board Design Issue[ Go to top ]

    Have you gone through the patterns section? I think I've seen some patterns there related to "read-mostly" type of patterns.

    A quite simple and clean solution could be to cache the latest threads list at application level (e.g. a static class, some object stored to "application" scope, etc.) and refresh the list upon new threads being started.
  3. Discussion Board Design Issue[ Go to top ]

    I would more then likely use a simple proxy design with a caching policy.


  4. Discussion Board Design Issue[ Go to top ]

    Thanks for the replies.

    Er, is that a design pattern which I could look up somewhere on this site?

    Coz, I'm just a beginner and I'm not really sure what a simple proxy design is ...
  5. Discussion Board Design Issue[ Go to top ]

    Actually, I just got done developing a forum/discussion board app.

    http://kabal-net.com/ *shamless plug*

    Going back now and thinking about caching and some admin-type tools. Of course in my app, I just have a board section, topics within that board and the threads.

    If anything within the design would have a case to be cached would be the board list. Since it is more in likely never (or all most never) change. As for your example, seems that you will have recent info regarding topics on your board/category page. Definitely don't want to cache that, but if you remove it then that would be a case to cache it in a list or however you would want too.

    Honestly, really comes down to how often is your board being used vs. how often is the data being changed. Has long as your using pooled connections, you should all right.