Archive for memcached

4Gamers.be Launched

After months of intense labor, togheter with PHP Developer Jens and Designer Michiel, I am pleased to announce that the new website 4gamers.be has reached the stadium of public beta. To make the whole website work, we used PHP, CodeIgniter, MySQL (MyIsam and InnoDB), Varnish and Memcache.

4Gamers is een nieuw belgisch gaming portaal dat nu een groot aantal van de (ex) 9-lives redactie bevat. Op de website vind je reviews, previews, specials, trailers, screenshot en de nieuwste releases. Buiten game nieuws richt 4Gamers zich ook voor een deel op esports en hardware. Zeker een website om eens te bezoeken!

Technical Aspects

CodeIgniter

It was the first time for me to do such a large scale project in CodeIgniter and I have to say CodeIgniter did dissapoint me on several points. The more I used CodeIgniter, the more I noticed that it was lacking basic features (or perhaps I suck at using Google?). First thing I can think of was the session class… I prefer to store my sessions in memcacge, but CI only has two choices (flat file or database).  Sure, you could extend the class and rewrite it. But I am not using a framework to do all this AGAIN.

Varnish

Varnish is always a breeze to use. Clear config files and it is slightly faster compared to Squid. The only issue encountered was while using Invision Power Board behind the proxy. It would not properly recognize whether or not a user is logged in (we base our caching on a certain cookie name & value combination). This results in no proxy caching being enabled on the forum… This is quite dissapointing as it can quickly become the backbone of all conversations on 4gamers. Sure enough I’ll find a solution…

Optimizing Drupal 6, Gain Performance and Stability!

drupal man says owwhhh yea!In general, Drupal will be sufficiently stable and performant enough to run your average website.  But when you are rebuilding your website or a website of your customer that gets tons of pageviews, you’ll start to encounter slowdowns, downtime & unexpected behaviour. Read more for Drupal 6 optimizing tips & tricks. Do note that I won’t be covering standard Drupal cache, I expect you to have this enabled already.

Read more »

Multiple memcache instances/servers on windows

Setting up memcache on windows is like taking candy from a baby. You can find all the information and the binaries for memcache at http://jehiah.cz/projects/memcached-win32/ . Note that these binaries will also work for x64 based windows.

A little trickier is to set up multiple instances of memcached on your windows machine. Basically you have to install the same memcache executable as many times as you want servers.

Installing memcache from the command line is simple:

sc create  "Memcached11211" binPath= "E:\webserver\memcached.exe -d runservice -p 11211 -m 128"  DisplayName= "Memcached11211" start= auto

Thus, for multiple instances this will be:

sc create  "Memcached11211" binPath= "E:\webserver\memcached.exe -d runservice -p 11211 -m 15"  DisplayName= "Memcached11211" start= auto
sc create  "Memcached11212" binPath= "E:\webserver\memcached.exe -d runservice -p 11212 -m 15"  DisplayName= "Memcached11212" start= auto
sc create  "Memcached11213" binPath= "E:\webserver\memcached.exe -d runservice -p 11213 -m 15"  DisplayName= "Memcached11213" start= auto
sc create  "Memcached11214" binPath= "E:\webserver\memcached.exe -d runservice -p 11214 -m 15"  DisplayName= "Memcached11214" start= auto
sc create  "Memcached11215" binPath= "E:\webserver\memcached.exe -d runservice -p 11215 -m 15"  DisplayName= "Memcached11215" start= auto
sc create  "Memcached11216" binPath= "E:\webserver\memcached.exe -d runservice -p 11216 -m 15"  DisplayName= "Memcached11216" start= auto
sc create  "Memcached11217" binPath= "E:\webserver\memcached.exe -d runservice -p 11217 -m 15"  DisplayName= "Memcached11217" start= auto
sc create  "Memcached11218" binPath= "E:\webserver\memcached.exe -d runservice -p 11218 -m 15"  DisplayName= "Memcached11218" start= auto
sc create  "Memcached11219" binPath= "E:\webserver\memcached.exe -d runservice -p 11219 -m 15"  DisplayName= "Memcached11219" start= auto
sc create  "Memcached11220" binPath= "E:\webserver\memcached.exe -d runservice -p 11220 -m 15"  DisplayName= "Memcached11220" start= auto
sc create  "Memcached11221" binPath= "E:\webserver\memcached.exe -d runservice -p 11221 -m 15"  DisplayName= "Memcached11221" start= auto
sc create  "Memcached11222" binPath= "E:\webserver\memcached.exe -d runservice -p 11222 -m 15"  DisplayName= "Memcached11222" start= auto

As you can see from the example above, you have to choose a different port for each memcache instance you are running.

memcache_connect() [function.memcache-connect]: Can’t connect to localhost:11211

Encountered this error? It could be as simple as switching the host from localhost to 127.0.0.1

before:

<?php
$memcache_obj = memcache_connect('localhost', 11211);

after:

<?php
$memcache_obj = memcache_connect('127.0.0.1', 11211);