Sunday, November 17

Geek

Fastly

Test version:
Hello Pixy Misa, you are logged in to Minx.
98kb generated in CPU 0.0, elapsed 0.0054 seconds.
14 queries taking 0.003 seconds, 25 records returned.
Powered by Minx 1.1.6c-pink.
The CPU timer has a ~10ms resolution, so it's not seeing anything. 3ms for database access, 5ms total to generate my home page.

Only issue is that posts and comments take up to a minute to percolate up to the home page and the sidebar.

How this will work:

When including a template [include ...] or invoking an applet [applet ...] you will be able to set cache directives:

cache - cache with the default system TTL (time-to-live, currently 60 seconds)
nocache - do not cache
ttl=N - set a custom TTL

Example: [include Posts ttl=30]

Applets are cached by default; regular template includes are not. You have to take care; if a template is included within a loop, and you cache it, it will evaluate once, and then repeat the content over and over. Probably not what you want.

Now I need to work on smarter cache eviction.

Another example, from one of Ace's crazy comment threads:
Hello Pixy Misa, you are logged in to Minx.
572kb generated in CPU 0.02, elapsed 0.0207 seconds.
41 queries taking 0.0086 seconds, 55 records returned.
Powered by Minx 1.1.6c-pink.
20 milliseconds to display 1408 comments. Not too shabby. Before caching, it took 1-2 seconds.

For Ace I wrote a custom template; the template is kind of clunky, but it works great. What I do is check the number of comments against 100-comment chunks, caching the full chunks, and leaving the final chunk uncached.

That way, the bulk of a long thread is cached, but the last few comments aren't, so new comments show up instantly.

Posted by: Pixy Misa at 03:59 PM | Comments (6) | Add Comment | Trackbacks (Suck)
Post contains 285 words, total size 2 kb.

1 Something's broken. The timestamp at the bottom of the article should be a link to the article, right? For my last two posts, though, it's "1312645". It's the same number for Wonderduck's last post.

Posted by: Steven Den Beste at Monday, November 18 2013 06:33 AM (+rSRq)

2 Right now I can't leave a comment on my "Noddare" post. When I click to do so, it goes to my F1 post instead.

Posted by: Steven Den Beste at Monday, November 18 2013 07:04 AM (+rSRq)

3 That's really, really, weird. I'll take a look now.

Posted by: Pixy Misa at Monday, November 18 2013 09:16 AM (PiXy!)

4 OK, it's fixed.

Posted by: Steven Den Beste at Monday, November 18 2013 09:33 AM (+rSRq)

5 Fixed.  I'm not 100% sure how it happened, but I suspect it had to do with the bulk import-and-fix I ran on Ace's site; that does include code to find and fix paths, and it look like it went wrong somehow.  Only 34 posts were affected (out of 900,000+) and it's not happening now, so fingers crossed!

Posted by: Pixy Misa at Monday, November 18 2013 09:34 AM (PiXy!)

Hide Comments | Add Comment

Comments are disabled. Post is locked.
48kb generated in CPU 0.0452, elapsed 0.1877 seconds.
56 queries taking 0.1733 seconds, 350 records returned.
Powered by Minx 1.1.6c-pink.