There are many caching system in use to optimize the execution of PHP script on busy web/database servers. Today we will focus on the OPcode caching method using APC.
Before we start… what is an OPcode?
The OPcode is an executable code generated each time a PHP script is interpreted and compiled. Each time you visit a webpage, the webserver (apache for example) would generate an OPcode of the PHP script serving your request. They are therefore simply C data structure which are interpreted by the PHP Virtual Machine (Zend Engine).
Now you can imagine, generating the OPcode can be a drain on the server and quite useless if the code does not change often. This is where the OPcode caching system comes into play; but before we go on, let’s see some OPcode example using the Vulcan Logic Disassembler.
First, we create a file test.php in which we will execute a unix ls -l command
test.php – <? system(“ls -l”); ?>
wrk01:/var/www# php -d vld.active=1 test.php
Branch analysis from position: 0
Return found
filename: /var/www/test.php
function name: (null)
number of ops: 4
compiled vars: none
line # op fetch ext return operands
——————————————————————————-
2 0 SEND_VAL ‘ls+-l’
1 DO_FCALL 1 ‘system’
4 2 RETURN 1
3* ZEND_HANDLE_EXCEPTION
Now let’s try a simple ( echo “hello world!” ) Read more…
As simple as this tip is, you will be amazed on how often it is overlooked during remote night maintenance work. I have therefore decided for that reason to post it here.
So, you are sitting at home, editing an IOS configuration of X router during a maintenance window. Your only available remote login is through the wan interface. A bad access list and you can be locked out of the router till you physically go to the office to undo the changes.
It is late and you don’t fancy driving!
Here is a small tip which could save you the hassle
Prior to editing
edge1#reload in 10
Reload scheduled in 10 minutes
Proceed with reload? [confirm]y
Now as you guessed, you just issued the router to reboot in 10 minutes
Now start editing…
When done, if all is good and all is working as expected, you can then proceed to cancel the scheduled reboot
edge1#reload cancel
The scheduled reboot is now cleared… if you happened to lock yourself out of the router, within the 10mn lapse time from the moment you issued the reload command, the router would reboot with the startup-config and give you access back to your router (assuming of course you didn’t save your running-config changes).
I hope that was informative!
MPLS – Multiprotocol Label Switching
The only purpose of this post is to demystify MPLS and hopefully give you a solid ground on which to build more knowledge on MPLS.
So what is MPLS?
Simply said, MPLS is just a forwarding/routing mechanism as opposed to traditional IP routing (static route/BGP/OSPF/RIP etc…) which enables faster IP processing/forwarding by integrating layer 2 information with layer 3 routing…
Having said that, we ought to remember than in traditional IP routing, whenever a router receives a packet, the packet is analyzed (DST field) against its forwarding table to determine the next hop. With MPLS, the packets no longer needs to be examined by the router as they are simply routed by looking at the packet tag and forwarded on a pre-configured Label Switch Path (LPS)
Before we go on, let’s define some terminology Read more…
I am not going to go over in details on the hoods of PPP (another post will be written for this purpose).
A deep understanding of Point-to-Point WAN networks isn’t required as we will barely scratch that surface when dealing with the “unnumbered IP command”.
So what is the unnumbered IP command?
The unnumbered IP command enables you to enable IP routing/processing on an interface by assigning it an IP already in used of another interface. That is to say, the unnumbered IP command enables you to have 2 interfaces, a multi-access interface and a point to point interface (often a serial port) to share the same IP address.
–> Now why would you do that? Simple, to save IPs and Read more…
It is often the case to receive a call in the middle of the night or walk into the office and find out a server which failed due to hardware problems.
What is mcelog?
From the project site description
mcelog decodes machine check events (hardware errors) on x86-64 machines running a 64-bit Linux kernel. It should be run regularly as a cron job on any x86-64 Linux system (if it is not in the default packages on your x86-64 distribution, please complain to your distributor). It can also decode machine check panic messages from console logs.
Now before we go on, it is important to understand what MCE is
MCE stands for Machine Check Exception, which is nothing but an AMD/Intel 64bit feature that allows to detect unrecoverable hardware problem such as “Communication errors between the motherboard and the CPU, CPU cache errors, Memory ECC erros etc..”
A common MCE log error would look like this
CPU 0: Machine Check Exception: 0000000400000000<0>
fault: 0000
CPU: 0
EIP: 0010:[mcheck_fault+225/336]
EFLAGS: 00010246
eax: 00000115 ebx: 72000000 ecx: 00000405 edx: 72000000
esi: 00000004 edi: 00000003 ebp: 00000115 esp: c3187f94
ds: 0018 es: 0018 ss: 0018
A program like syslogd will write the message to the console or to the kernel log; if the machine crashes, then only to the console.
mcelog will therefore “decode” those machine event errors, which are saved in the special kernel buffer /dev/mcelog.
Work with mcelog
mcelog should be run as a cron
/usr/sbin/mcelog –generic –ignorenodev –filter >> /var/log/mcelog
Make sure to check the man page of mcelog for all the options.
I would recommend setting up a script to email you in case of alerts or even why not “pipe your mcelog through a socket”
That’s it. Hopefully from now, you can catch system, hardware errors before a kernel panic
Cheers,