@Boris

my concern is following:
a forum is a high traffic part of a website. I just thought without
having checked,
that for example every 10min a user posts a new comment to the forum,
then
every 10min the whole result set has to be set to memcache.
therefore I thought, if would be clever to never touch old comments
and just
update pages which are really involved to be updated.

answering your questions:
1. the list is ordered by timestamp DESC, therefore it is fixed
2. no idea. I just wanted to to plan a memcache setup which
should be theoretically better than sending queries to mysql.

On 16 Sep., 20:32, "Boris Partensky" <[EMAIL PROTECTED]>
wrote:
> A couple of comments:
>
> 1. Is the order of comments in the list (the way it is shown to a user) user
> defined or is it always ordered by timestamp, most recent first? If latter,
> than you can store pages of comments. So if forum id is 123, then keys will
> be constructed as (123_0, 123_1, 123_2). If comments are added or removed,
> then of course you need to
> invalidate all the keys associated with that topic. If order is user
> defined, meaning that pages may differ depending on who is looking at them,
> then it's more tricky of course, because you need to keep the whole list in
> memcache (and sort/create pages in memory), but you may not be able to keep
> the whole thing because of memcache size limitations.
>
> 2. Just curious: what is your concern about running the whole comments list
> query every time someone adds/removes comment? I assume there is still much
> muc fewer reads than writes and you may still get tremendous gain even if
> you invalidate the entire cache every time a topic is touched.
> Is this query expensive?  If yes, then have you looked at query plan? Also,
> how many comments on average are there in a forum? Hundreds? Tens?
>
> Boris
>
>
>
> On Tue, Sep 16, 2008 at 1:59 PM, dantro <[EMAIL PROTECTED]> wrote:
>
> > dear memcache fans
>
> > i am looking for a solution nearly a week. my problems deals with
> > memcache and pagination.
>
> > for example (without memcache):
> > my site offers the possibility to post comments. if an user looks at
> > the comments site i query
> > the database via "SELECT [..] LIMIT x,y". per page I am showing 20
> > comments. If I have 100
> > comments it leads to 5 pages a 20 comments.
> > Now I am looking for a solution to put these comments into memcache
> > parallel to mysql.
> > I don't know, understand how to deal with memcache if a comments get
> > deleted or added.
> > I want to prevent querying the whole comments list ("SELECT id,...
> > WHERE forumid=$fid").
>
> > Do you have any solutions or what are your setups to handle memcache
> > and mysql pagination
> > with "LIMIT x,y" when you add or delete entries.
>
> > Thank you very much for helping..
> > I really tried to find practical solutions!
>
> > Dan
>
> --
> --Boris

Reply via email to