Join / Forgotten your password?
 
HomeFeaturesStoreForumsWikiWorkshopsJobsPortfolioGalleryEvents Members
 
> CGPortfolio Home       > About CGPortfolio       > Intro Video      > Create Portfolio      > Manage Portfolio       > Browse       > Search       > Help     
 
Robert Mibus
Mibus



Location:
Aldinga Beach, Australia

Language(s):
English

Member Since:
April 2003

Last Updated:
25 July 2008

Portfolio Views:
37935
Chosen as Favorite:
6
Groups:
Advanced Search
galleryaboutblogguestbook

February 15, 2008. 05:20
Proxies... or not
Well, my grand idea of using a transparent proxy died a violent death last week, thanks to cookies.

Wikipedia's solution - what makes it usable for rendered PHP/HTML - is to have a "Vary: Cookies" header, so that pages are only cached between users with identical cookies. Logged-out wikipedians have no cookies, so they all get the cached pages. (Note also that nothing about the page is specific to that logged-out user - nothing at all. Something to keep in mind!).

We, however, keep cookies. Google Analytics keeps cookies on our behalf (so we can track stuff), vBulletin keeps cookies (to try to have read/unread thread stuff work when you're logged out), and cookies are kept so we can track how many unqiue users are online. (The front page of the forums tell you how many logged-out users are online).

So that idea is a bust.

It turns out, though, that it's fairly easy to adjust the main CGP pages to cache the whole page to disk. For the PHP programmers out there, check out the ob_start() family of functions. They let you do cool things like grab what you've already rendered of the page, and do stuff with it. We use it all over the place - from interacting with vBulletin, to adjusting image sources to take into account SSL. It's a great way to hack some extra functionality in, and this time it's for caching.

Again, we've only been trialling this for logged out users. A few astute people have noticed that some actions are "forgotten" temporarily when they log out. That's why!

I've also been going through CGP code, cleaning up various bits and pieces, and combining chunks of cached data whenever possible. Right now, rendering a page can use so many different DB queries and memcache queries that it's downright scary! Even though memcache is so fast, the sheer number of requests is adding that extra bit of latency. The "networks" code had a good clean-up in particular today - let me know if you notice any oddities.

On a note related to my last entry, I've written a new hacked-up priority engine (again!!). This one is based on a different premise entirely - instead of trying to mathematically "solve" a rather complex problem, it instead iterates over a large set of ad:zone priority combinations and scores each combination, until it finds a better solution - effectively brute-forces the problem. So far it's running OK, and I'm hoping (along with another neat trick that's not up for discussion today) that it will solve the majority of our priority issues.

(As with the last engine, low-pri campaigns aren't yet taken into account. It shouldn't be too hard to do it with this engine).
February 05, 2008. 05:36
Ads and cephalopods
OpenAds' priority calculations are continuing to cause frustration. Trying the "zone patterning" option in 2.4.3 shows no improvement. I'm tempted by the offer of a 2.5 beta, but do I really want to spend a lot of time getting it running perfectly in production?

One thing I realised I haven't mentioned, that's useful information for anyone running a site with multiple servers, is how we set up OpenAds. We have OA installed on a server nearly by itself (the server run CGPortfolio, DB-heavy but otherwise has fairly low load). Both the OA site and DB are on that server (we have enough disk I/O on the main DB server as it is!).

The important part of the setup, is how we invoke the ads. Using PHP to invoke ads is a bit cumbersome, and isn't always easy to insert into other sites. Using Javascript hangs the browser if you have problems with your ads server, and using XML-RPC hangs your web servers when your ad server is having problems!

The by far best method we've used yet to insert ads is IFrames. It's just plain text (no database work or anything) for the server, it's asynchronous for the client. If something goes horribly wrong, you just get a blank spot where the ad should be.

As for the squids, I mention it only because I've just hacked up some of CGPortfolio to bypass actually generating a page if there's a valid cached copy, but only for logged-out users. Right now, it's pretty limited (since it'll only be when your browser hits a page multiple times), but I intend to shortly whack a squid reverse-proxy in front of it to try to cache more stuff internally. If it goes well we'll start looking at expiring pages in squid based on PHP - I love this stuff
 
  Robert Mibus's Personal Network