Archive | March, 2012

How To Install The Latest APC 3.1.9 On Ubuntu 10.04 LTS & W3 Total Cache Optimization

Yah another geeky post – woohoo! Anyway, when you are running high traffic WordPress sites – it’s very common to use W3 Total Cache (known as w3tc usually).

And with this you need some kind of in memory cache to store objects/db queries etc – the choice for a single server setup is generally APC as it’s part of the PHP core now (used to be eAccelerator/Xcache were contenders too).

Anyway never use APC for page caching – use disk enhanced and make sure your rewrites are working properly – your site will fly. For Object Cache and Database Cache – you should use APC (if you have a multi-machine cluster then use memcached).

The problem you might face (especially on Ubuntu 10.04) is that it uses a fairly old version of PHP and thus APC (3.1.3). I was facing horrible fragmentation with this setup and it will effect server performance over time. I could see from my monitoring that it was reaching over 20% fragmentation, this is not super bad – but over 10% is enough to worry for me as I’m a performance freak.

Munin php-apc graphing

I tried various different tweaks (ttl 0, ttl 7200, ttl 3200) but it wouldn’t go down. I eventually figured out I might try updating apc, rather than sticking with the one installed using: aptitude install php-apc.

Assuming you already have php-apc installed and configured, this single command will remove it, and install the latest version of APC.

sudo aptitude remove php-apc; sudo aptitude install php-pear libpcre3 libpcre3-dev; sudo pecl install apc

Then all you need to do is:

sudo /etc/init.d/apache2 restart

Or for nginx/php-fpm (my preference now):

sudo /etc/init.d/nginx stop; sudo /etc/init.d/php5-fpm stop; sudo /etc/init.d/nginx start; sudo /etc/init.d/php5-fpm start

And that’s it, now you’ll have the latest version of APC running and you should see a LOT less fragmentation (mine is hovering about 4% now instead of 20%).

php-apc fragmentation

I’ll keep an eye on it, perhaps change the apc.ini settings a little more (usually found in /etc/php5/conf.d/apc.ini) – for reference if you want those, here they are 🙂


extension=apc.so

apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 128M
apc.optimization = 0
apc.num_files_hint = 2048
apc.user_entries_hint = 2048
apc.ttl = 7200
apc.user_ttl = 3600
apc.gc_ttl = 600
apc.cache_by_default = 1
apc.filters = "-/home/username/domains/yoursite.com/public_html/apc.php$"
apc.mmap_file_mask = "/tmp/apc.XXXXXX"
apc.slam_defense = 0
apc.file_update_protection = 2
apc.user_request_time = 1
apc.enable_cli = 0
apc.max_file_size = 2M
apc.stat = 1
apc.write_lock = 1
apc.report_autofilter = 0
apc.include_once_override = 0
apc.rfc1867 = 0
apc.rfc1867_prefix = "upload_"
apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
apc.rfc1867_freq = 0
apc.localcache = 1
apc.localcache.size = 1024
apc.coredump_unmap = 0
apc.stat_ctime = 0

Enjoy!

Tags: , , , , , , , , , , , , , ,

Continue Reading · 2 Comments · Internet & Tech, Sys Admin & DevOps

Happy 34th Birthday To Me!

Yah it’s my birthday again – wooohoo!

This is actually a scheduled post, because right now I’m somewhere in the World – and it’s a surprise (this was written March 18th and I have no idea where I’m going).

I guess you’ll most likely see where I’m headed on Twitter, so follow me there – @ShaolinTiger

Here’s a picture of me enjoying a beer on the beach in Koh Lipe last November.

Koh Lipe 2011

So yah, happy birthday to me and thanks to my awesome wife Kimberly for taking me away on a surprise birthday holiday!

Tags: , , , ,

Continue Reading · 4 Comments · Site News

Future Music Festival Asia (FMFA) 2012 – With Chase & Status And Pendulum

You should know by now, I’m a MASSIVE electronic music fan – especially Drum and Bass.

One of my favourite acts is Chase & Status, a pair of fairly nerdy looking white dudes from London – followed by Camo & Crooked and then probably Pendulum. You can imagine my surprise (and pure delight) when I saw the lineup for Future Music Festival Asia 2012 (hereon known as FMFA) included both Chase & Status and Pendulum!

Imagine my dismay later..when they scheduled them both on at the same time…WTF? Seriously – there’s 2 DnB acts on in the WHOLE festival and 5 different stages – and they put them both on AT THE SAME FUCKING TIME. Pendulum was on for 2 hours (8.30pm-10.30pm), but was only a DJ set and Chase & Status was LIVE (8.30pm-9.30pm)! So yah!

We headed there around 7pm just as the sun was going down, I got my best junglist massive outfit on – ready to rinse out.

Junglist Massive

Yah my cap should have been Burberry, but I don’t have one – so neh. We chilled for a while first whilst the sun went down, grabbed a couple of beers and kicked back on the grass.

FMFA2012 Sunset

We were waiting quite a while, as the schedule seem to have gotten knocked back quite a while.

Waiting for something to happen..

The first act we caught was the rather late starting Sneaky Sound System, they were really really good live – the singer was incredible (both her vocals and her stage presence). Her name is Connie Mitchell and man can she move.

Sneaky Sound System - Future Music Festival Asia (FMFA) 2012

We were a fair way back at that point and it was a nice warm up to the festival, but really I was waiting for 8.30pm for Chase & Status to come on..they were delayed though and only started after 9 I think. I was happy to see the DJ decks rolled off and a full drum kit exposed with guitars and all sorts coming out – this meant 1 thing..

Chase & Status were going to be playing their music live! We headed right down into the chaos at the front, right next to the fence.

Chase & Status FMFA2012

Yah drum and bass played live on a drumkit – you can’t beat that shit seriously. They started out banging straight away with insane Dubstep and Drum n Bass tracks assaulting us non-stop. This is how sweaty you look after dancing and jumping to awesome dnb for half an hour or so.

Me & Kim at FMFA 2012

Then a female vocalist came out to perform Heartbeat and Time, I didn’t really catch her name – I think it was Holly something. Time was mind-blowing live.

Chase & Status FMFA2012

Here’s a short clip of it, apologies for the sound quality but the camera was clearly overwhelmed by the epic basslines. Listen to the original here.

The moshpit in front was getting pretty mad too, I wanted to join in…but I was scared I’d crush them all. This was during Fool Yourself – listen to the original here.

I didn’t take all that many pics or videos because I was busy mashing it up, junglist stylee. Their set finished at 10:08pm – it was legendary.

Chase & Status FMFA2012

After that we headed down to the other stage to catch the end of Pendulum, it was a DJ set though so it’s not the same – but Pendulum does have some mad tunes (like Watercolour). I would have liked to get down the front and mash it up for an hour – but due the timing – it wasn’t happening.

Just hung out at the back and caught the last 2-3 tracks he dropped.

Pendulum FMFA2012

It was ok, wondered around for a while – went to see Tinie Tempah – thought he was shite and left – headed back down to wait for Chemical Brothers to start..

There was a whole lot of confusion down there, no lights, no spotlight on the stage, no intro, no wording on the backdrop, no emcee – no one actually had any idea if Chemical Brothers had started playing or not.

And honestly whoever was playing was pretty shit, the music was meh. We hung around for half an hour or so, then headed off home. I heard Cosmic Gate and Wombats were good – but I wasn’t going to wait around through all that monotony till 2-3am to catch them both.

Got back in time for some awesome frog porridge in SS2 then off home to bed.

Honestly I would have driven all the way there, paid and gone home happily after an hour just to see Chase & Status live – it was that good. I hope I see them again…soon!

Tags: , , , , , , , , , , , , , ,

Continue Reading · 2 Comments · Music, Parties & Gatherings

Running Unattended/Automatic Security Updates on Ubuntu 10.04 LTS Lucid

I thought I may as well share/dump some of the tech stuff I learn on here because a) A lot of the stuff I find on Google is complete crap and b) If I forget how to do it I can just search my own blog (w00t) c) It might be useful to someone else.

Anyway, the objective of this exercise is to install security updates on Ubuntu automatically – commonly known as unattended updates (without any operator intervention). It’s not considered safe to install ALL updates unattended – just in case something goes wrong, but for security updates it’s important to install them ASAP.

And it saves you logging in to however many servers you manage (100+ for me currently) and running sudo aptitude update; sudo aptitude safe-upgrade; on all of them.

I wanted to achieve this without installing any additional software – so it can run on a bare-bones install (I’m a server minimalist).

In this case it’s for Ubuntu 10.04 LTS (we only use LTS versions of Ubuntu for production) but it should work on any Debian based variant. Ok first up:

sudo nano /etc/cron.weekly/apt-security-updates

When you have that non-existent file open, paste this inside:

echo "******START********" >> /var/log/apt-security-updates
date >> /var/log/apt-security-updates
aptitude update >> /var/log/apt-security-updates
aptitude safe-upgrade -o Aptitude::Delete-Unused=false --assume-yes --target-release lsb_release -cs-security >> /var/log/apt-security-updates
echo "Security updates (if any) installed at:" >> /var/log/apt-security-updates
date >> /var/log/apt-security-updates
echo "******END********" >> /var/log/apt-security-updates

Then make that file executable with the following command:

sudo chmod +x /etc/cron.weekly/apt-security-updates

What that file basically does is runs aptitude update and aptitude safe-upgrade and logs it all to a file – /var/log/apt-security-updates – so just in case if something goes wrong – you know which packages to look at.

Because it’s logging to a file, just one last precaution – so you don’t run out of disk space – is to add it to logrotate.

So what we do is create the following file:

sudo nano /etc/logrotate.d/apt-security-updates

Then paste this in:


/var/log/apt-security-updates {
rotate 2
weekly
size 250k
compress
notifempty
}

And that’s it, your machine will get updated with the latest security updates once a week and your HDD won’t explode because of huge log files.

Tags: , , , , , , , ,

Continue Reading · No Comments · Internet & Tech, Sys Admin & DevOps

KONY 2012 – Make a Difference

First and foremost – this is incredible film making.

KONY 2012 from INVISIBLE CHILDREN on Vimeo.

Secondly, it’s an amazing cause – and yes we can all make a difference.

You can join Invisible Children on Facebook here:

https://www.facebook.com/invisiblechildren

Join the cause here:

https://kony2012.com/

And donate here:

https://www.stayclassy.org/checkout/donation?eid=14711

Tags: , , , , , , ,

Continue Reading · No Comments · Serious Issues