Category Archives: General

Battling the “Slashdot Effect”

I’ve always wondered what exactly one can do to combat high volume traffic from slashdot, digg, reddit and other populate news sites – known commonly as the Slashdot effect. The other day, I got a first hand opportunity to find out.  One of our clients sites was posted to multiple news site – so what better way to try out and see what works in a real life slashdotting.  Below, is the solution I ended up with that seemed to remove a significant amount of strain from the server without costing any additional money.

As I was doing some research, I came across some creative uses of the Coral CDN – and I have previously used lighttpd for high volume sites – so I put the two together. For those of you that don’t know about Coral CDN, its a peer-to-peer content distribution network. To take advantage of the CDN its easily – simply append .nyud.net to the end of any dns name and that’s it!  Since the site I was dealing with was fully dynamic, I did not have a lot of options that could be quickly implemented.

Once you get lighttpd setup, here are the example config bits to setup and perform the redirect:

# make sure this isn't CoralCache requesting content
$HTTP["useragent"] !~ "^CoralWebPrx" {
    # make sure that this wasn't sent back to us from CoralCache
    $HTTP["querystring"] !~ "(^|&)coral-no-serve$" {
        url.redirect = ( "^/.*" => "http://%1.nyud.net$0" )
    }
}

The above will redirect all requests that do not have the Coral CDN user agent. It’s important to add this or else you’ll get a redirect loop.  Also – make sure you enable the "rewrite" and "redirect" server modules. 

For those of you that are using apache, you can add rules similiar to:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !^CoralWebPrx
RewriteRule ^(.*)$ http://yourdomain.com.nyud.net/$1 [R,L]

In the end, caching, static pages, and load balancing is your best bet. But if your in a bind, lighttpd and Coral CDN will do the trick!

The Quest to Conquer the PHP Session Timeout

PHP sessions are handy little things, however it’s a bit tricky to correctly get a custom timeout to work correctly. There are a few key ini settings:

session.gc_maxlifetime -This setting (in seconds) tells the PHP garbage collector how long to keep the session valid.  The default is 24 minutes.

session.gc_probability – The probability that the garbage collector will run and clean up old session data.  The default value is 1.

session.gc_divisor – The divisor to use with the probability.  The default value is 100.

session.save_path – The path for session values to be saved.  The default is /tmp, however it is important to change this to a custom folder for the application – especially if you are in a shared hosting enviorment.  The garbage collector does not discriminate, and it will delete ANY session data that is older than the set limit, not just ones that correspond to your application.

session.cookie_lifetime – How long to keep the cookie written to the client machine valid.  Defaults to 0, which means the cookie will expire at the end of the broswer session (at logout or when closing the broswer).

Now, before you start anything, make sure you have a writable folder setup for your application that you can use to store your session data.

Start your session with something smiliar to:

ini_set(‘session.gc_maxlifetime’, ‘86400’);
ini_set(‘session.gc_divisor’, ‘1’);
ini_set(‘session.gc_probability’, ‘1’);
ini_set(‘session.cookie_lifetime’, ‘0’);
ini_set(‘session.save_path’, /path/to/sessions/myapp);
session_name(‘myapp’);
session_start();

Setting the above configuration well make sure your session files are saveed in a seperate folder, they will expire in 24 hours, and the garbage collector will run everytime session_start is called to cleanup expired sessions.

The problem with alot of other infomormation is that they will suggest setting the cookie_lifetime to be the same as the gc_maxlifetime.  The problem with this is that when the cookie value is set, the expiration date is not updated as the user continues to be active in the application.  The session data on the server side is updated.  So, if this is the case, after the value of cookie_lifetime has expired, even if the session data on the server was just updated, your session will be invalid, and you will be required to login again.

I hope that this post will help someone else in the quest to conquer the php session timeout.  It definitely is not very clear, and can be very confusing!

The Landlord

So, today my landlord (who’s name I will not mention) decided it would be a good idea to re-key the outside doors to my building.  I don’t know about you, but after getting home from a long day a work, the last thing you want to do is figure out why you can’t get into your building.  So, I called the main office, and they informed me that I received a note yesterday (which there was no trace off).  After a few minutes of bitching them out about their lack of notice, and failure to inform tenates and post signs, I walked over to get a new key.  Needless to say, now they have posted signs saying they have re-keyed the building.

Maybe I should send Pearl to talk some sense into my landlord 🙂

International Dinner 07

Friday night Sami talked me into going to the International Dinner on campus. For $10 for students, $16 for everyone else you get to try a wide variety of dishes from different countries. Even though the food was prepared by Chartwells, it was still pretty good. The menu was as follows:

Salad:

  • Tunisian Couscous Salad – North Africa
  • Baba Ganouj (roasted eggplant dip) – Middle East
  • Kim Chi (fermented cabbage) – Korea

Entree:

  • Pork with Dumplings & Cabbage – Czech Republic
  • Pad Thai (meatless) – Thailand
  • Hungarian Chicken Paprika – Hungary

Side Dish:

  • Cauliflower Curry – Nepal
  • Jamaican Rice with Peas – Jamaica
  • Lecso (simmered peppers & tomatoes) – Hungary

Dessert:

  • Conconut Toto – Jamaica
  • Apple Strudel – Czech Republic

As you can see, its quite the variety. Every got a recipe book as well. Any bets what I’ll make first?

It’s mid April already?

Well its been quite a while since I posted anything here, so I figured it’s time to post a little update. As usual, I’ve been pretty busy with work and such. This last weekend was more eventful than most.

Friday Mr. Nolan decided to grace whitewater with his presence. After minor begging, i was persuaded to go out for a bit and get jumped on by Mr Snieg. Does anyone really know why Snieg is a jumper? I think its somehow related to the genetics of the Monguin gene.

Saturday start out with a great nights sleep, followed up by 2 naps! (Can’t go wrong there). That evening I ventured to Elkhorn where Paul, Michelle, Dohr and myself went out to dinner at Popeye’s in Lake Geneva. It was my first time there, very tasty. After dinner we tormented Sadie with the woot screaming monkey!

Today I decided to invest in a Wireless Cell Phone Extender, I’m curious to see if it actually works. If it doesn’t, at least there is a 30 day guarantee. I also decided to purchase an I-Pass, I’ve had enough of the Illinois tolls!

Well, thats about it for my excitement. Until next time, keep your stick on the ice!

PS. Does anyone know what that phrase is from? 🙂

Random Crap!

My random crap came today. Inside I was graced with the following items:

  • 1 – Screaming Flying Monkey w/Woot Cape
  • 1 – Targus Travel bag
  • 1 – Texas Holdem Electronic Game
  • 1 – Barbie Phone

Don’t believe me? See for yourself:

Check out the gallery for more pictures: Fools Crap

T-Mobile Caller ID

Ever wondered how to get your name to show up when you call a land line from your cell phone? Apparently, you can just give T-Mobile Customer Care a call and they can set the text which appears individually for each line. There is about a 24 hour processing time for the change to take place, but nonetheless, its a pointless cool feature. So, hopefully in 24 hours my name is no longer "Cell Phone WI".

Winter is Here

Today, the current temperates around Wisconsin are the same (or colder) than areas of Alaska, is it just me, or does that sound a little nuts? It’s been a busy past month with things happening at work at UW-Whitewater and also with Modevia. We finally go the new Modevia website launched – www.modevia.com – check it out! The new support center is hopefully right around the corner as well!

I also recently aquired a new domain name which I have moved my personal email address – aaron at axelsen dot us. Hopefully in the new future, i’ll also launch a website there as well. Check back in the future for updates!

That’s all for now, stay warm!