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.
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 (
But what if you need a simple and lightweight alternative with supervision capability ?
runit is a very good choice, and you can use it to replace or complement
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 #!/bin/sh 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.
sv can be use to send pretty much every unix signal (HUP, USR1, USR2, etc…).
Logging process output
runit process logging is dead simple: let your process send it data to
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
# vi /etc/sv/varnish/log #!/bin/sh exec svlogd -tt /var/log/varnishd
runit, just follow the official documentation.
Disable log tables usage
If you already have an external “profiling” tool you can trash the content of several magento table like:
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:
It recommended to not put
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 ;
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.
As you should already know pushing to production environment on a Friday is a very very bad idea. This generally end like this:
Or even worse by a call to the poor on-duty sysadmin on a Saturday night. So next time a dev ask you about pushing anything in production on a Friday just give him this link: www.estcequonmetenprodaujourdhui.info.
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
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 debian.org Server: 220.127.116.11 Address: 18.104.22.168#53 Non-authoritative answer: Name: debian.org Address: 22.214.171.124
Using a specific DNS server:
# nslookup debian.org 126.96.36.199 Server: 188.8.131.52 Address: 184.108.40.206#53 Non-authoritative answer: Name: debian.org Address: 220.127.116.11
Query the MX Record
# nslookup -query=mx debian.org Server: 18.104.22.168 Address: 22.214.171.124#53 Non-authoritative answer: debian.org mail exchanger = 0 muffat.debian.org. debian.org mail exchanger = 0 mailly.debian.org.
Here we have two MX (mail exchange) server for the zone debian.org
Query the NS Record
# nslookup -query=ns debian.org Server: 126.96.36.199 Address: 188.8.131.52#53 Non-authoritative answer: debian.org nameserver = dns1.easydns.com. debian.org nameserver = debian1.dnsnode.net. debian.org nameserver = dns4.easydns.info. debian.org nameserver = sec1.rcode0.net. debian.org nameserver = sec2.rcode0.net.
The NS record give the domain’s authoritative DNS servers list.
Query the SOA Record
# nslookup -query=soa debian.org Server: 184.108.40.206 Address: 220.127.116.11#53 Non-authoritative answer: debian.org origin = denis.debian.org mail addr = hostmaster.debian.org 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.