Startup blogs

Many startups and technology companies publish a blog in which they talk about their technical problems. These blogs are a great source of first-hand in information for developers and admins. You can find a post in french with a good listing of blogs to add into our favorite RSS-reader here.

Fallacies of distributed computing

The fallacies of distributed computing are a set of assertions made by L Peter Deutsch and others at Sun Microsystems describing false assumptions that programmers new to distributed applications invariably make.


During the last ten years many initd alternatives have appeared. Some are very “SysV-like” like initng. Others are way more radical in their design both more modern and complex (systemd / upstart).

But what if you need a simple and lightweight alternative with supervision capability ?

Then runit is a very good choice, and you can use it to replace or complement initd.

Install runit

aptitude install runit

Add a service to supervise

The core of runit is the /etc/sv directory. This directory contains a subdirectory for each process that runit should manage. Let say we want to add a varnish service:

# vi /etc/sv/varnish/run
exec 2>&1
. /etc/default/varnish 
rm -f /var/lib/varnish/$INSTANCE/*
exec varnishd -F $DAEMON_OPTS

Simple and neat. Note that the process shouldn’t be launch in background / daemonized mode. If necessary add the appropriate option. Then:

# chmod +x run
mkdir supervise
chmod 755 supervise

Now don’t forget to add a diversion to the official initscript and then enable the supervision:

ln -s  /etc/sv/varnish /etc/service/varnish

The sv command

sv status gu-monprojet
sv check gu-monprojet
sv up gu-monprojet
sv down gu-monprojet
sv restart gu-monprojet

As you can see commands are very straightforwards.

Note that sv can be use to send pretty much every unix signal (HUP, USR1, USR2, etc…).

Logging process output

Under runit process logging is dead simple: let your process send it data to STDOUT and svlogd will do the rest. This program collect your process’s data and save it into a system-standard location. It will take care of rotating log file if necessary by itself.

To add a log to a process create a log script:

# vi /etc/sv/varnish/log
exec svlogd -tt /var/log/varnishd

Replace initd

To replace initd by runit, just follow the official documentation.

[Magento] Various tips

Disable log tables usage

If you already have an external “profiling” tool you can trash the content of several magento table like:

  • log_customer
  • log_quote
  • log_summary
  • log_summary_type
  • log_url
  • log_url_info
  • log_visitor
  • log_visitor_info
  • log_visitor_online

and replace the engine for them by ‘blackhole’. This will significantly improves performance.
You can find more info on the subject here.

Directories and NFS

The following directories can be shared inside NFS share:

  • var/cache
  • var/locks
  • var/media
  • var/exports

It recommended to not put var/report and var/logs inside.

SQL request for finding the number of order

mysql> select count(*), date_format(updated_at, '%Y%m%d %H') as datum from sales_flat_order where created_at > '2013-11-20' group by datum ;

[Magento] Session and zend_mm_heap corrupted

Since version 1.3 Magento can use multiple layer of cache, for example a memcached for content cache and session, and a database for the rest. This mechanism work pretty well except when you have a connectivity problem.

If Magento is unable to load a session, the request processing will end immediately preventing Apache from logging it. The only information inside the error log will be an zend_mm_heap corrupted entry.

To ‘fix’ this behavior, you must increase the default timeout for the PHP session handler for a value greater than the TCP re-transmission delay. A 5 seconds value is good enough.

Secret Order of the Ninja Code Monkeys

We are society’s most elite programmers, we are the guardian of 0 and 1, we protect your systems when you aren’t around, we are who you can turn to when you need help with your application. Our members are widely diversified and dispersed all over the world and our mission is to make this world a better place using out keen and sometimes supernatural coding styles along with our true spirits and extreme discipline. Together we are making a difference !

The Order of the Ninja Code Monkeys has been in existence for many years now and have thousands of members. Now we are taking our outreach even farther by opening the nether portal to enlightenment outside our practicing realm and into cyberspace.

The Secret Order of the Ninja Code Monkeys follow very specific rules :

  • We accomplish the mission, failure is not an option
  • We never write any SPECS
  • We NEVER comment our code (you figure it out)
  • We NEVER free (good) food
  • We NEVER give real estimates of how long it will take
  • We NEVER tell how we did it (you won’t understand)
  • We NEVER Bring Harm to a user- by choice
  • We live to be challenged
  • Working Applications must be modified
  • The newer the technology, the more dangerous we become
  • We strive for peace, harmony, and enlightment in all things
  • Always being Honor to yourself

Now get your t-shirt and join us or ask a ninja what it’s to be a ninja.


nslookup is a network administration tool for querying DNS servers. nslookup is very useful tool for debugging DNS record.

Query a domain name

Using the current ‘default’ DNS server:

# nslookup 

Non-authoritative answer:

Using a specific DNS server:

# nslookup

Non-authoritative answer:

Query the MX Record

# nslookup -query=mx 

Non-authoritative answer:      mail exchanger = 0      mail exchanger = 0

Here we have two MX (mail exchange) server for the zone

Query the NS Record

# nslookup -query=ns 

Non-authoritative answer:      nameserver =      nameserver =      nameserver =      nameserver =      nameserver =

The NS record give the domain’s authoritative DNS servers list.

Query the SOA Record

# nslookup -query=soa 

Non-authoritative answer:
        origin =
        mail addr =
        serial = 2016092612
        refresh = 1800
        retry = 600
        expire = 1814400
        minimum = 600

The SOA record (start of authority) give information about the domain, it TTL, the e-mail address of the domain administrator, the domain serial number, etc…

Further Reading and sources


Racktables is a software solution for datacenter and server room asset management. It helps document hardware assets, network addresses, space in racks, VLAN, etc…

You can find more info on the subject on the official website.