Welcome!

Linux Containers Authors: Liz McMillan, AppDynamics Blog, Flint Brenton, Elizabeth White, Pat Romanski

Related Topics: Linux Containers, Java IoT, Open Source Cloud, Apache

Linux Containers: Blog Feed Post

Basic Apache and MySQL Performance Tuning

Part 1: Apache

Apache and MySQL make up the backbone of many Linux based web servers. According to the August 2011 Web Server Survey by Netcraft, Apache currently runs on 65.18% (or 301,771,518!) of web servers.  Similarly, MySQL is the most popular open source database and holds a significant portion of the market share – especially for web content.  This article will detail how you can get at the ‘low-hanging fruit’ in order to make some simple changes that will yield big performance gains.

Apache Tuning
If your system is running httpd, the Apache web server, it will definitely benefit you to evaluate and modify your web server configuration to ensure that your system runs smooth.  This can be an incredibly broad topic and certain an article of its own, but here are a few things you can address that can provide a big impact in your performance.

First, ensure that your MaxClients value is set appropriately for your system.  This will vary based on a great many factors – what kind of content your server is serving up, the kind of PHP or other scripts you’re running, how they’re coded, etc.  Here’s a quick bash one liner that will show you the average memory each httpd process is utilizing:

total=0; for memory in `ps aux | grep [h]ttpd | awk '{print $4}'`; do total=`echo "scale=2; $memory + $total" | bc`; done; echo -n "Average percentage of total memory: "; echo "scale=2; $total/ `ps aux | grep -c [h]ttpd`" | bc

This command will add up the total percentage of memory in use by all httpd processes and average it out among the number of processes.  It’s certainly not perfect, but it will give you a good idea of what each process is doing.  When I ran this command on one of my servers, I had an average percentage of 0.18% of total memory.

Next, you’ll want to see what your MaxClients value is set to in your Apache configuration.  Let’s say it’s set to 256:

[root@server ~]# grep MaxClients /etc/httpd/conf/httpd.conf
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
MaxClients       256

To determine the maximum memory that Apache can use based on on the average memory utilization per process of 0.18%, take this value times the MaxClients setting.  This gives us 46.08% of memory – well within normal limits.

For optimum performance, you’ll want to tweak Apache’s MaxClients setting such that Apache can consume no more than 70% of your available physical memory.  Any higher and you risk the box starting to dip heavily into swap space, which will drastically increase IO and CPU wait and can easily cause the server to fall to its knees.

If you’re seeing very high memory utilization per process, it’s possible that it could be due to a memory leak.  The best solution would be to examine your application’s code to locate and resolve the memory leak, but often this isn’t an option for system administrators.  You can mitigate the damage poorly coded applications can have on your server by adjusting the MaxRequestsPerChild directive.  The higher this value is set, the more requests a child process will handle before the parent process kills it off and spawns a new one.  Lowering this value will cause Apache to recycle its children processes more often, freeing up memory that would otherwise be held.  You’ll need to work to find a balance here as each time Apache recycles a child process it must utilize extra CPU time, so setting this value  too high can cause CPU utilization issues.

It’s also a good idea to only enable the modules in Apache that are actually necessary.  Depending on your installation source, you likely have several running and enabled that aren’t necessary and can in fact open up some security holes.  You can check what modules are enabled by calling the Apache binary with the following options (you may need to modify the path and binary name depending on your distro):

/usr/sbin/httpd -t -D DUMP_MODULES

You’ll have many outputted and again, some research will be required to determine exactly what is necessary.  For instance, you might not need the proxy_* modules – proxy_balancer, proxy_ftp_module, etc.  You can often simply comment these out in your httpd configuration.  The Apache httpd manual provides full information on most of these modules so you can determine their necessity:  http://httpd.apache.org/docs/2.2/

Also read  25 Apache Performance Tuning Tips

Read the original blog entry...

More Stories By Hovhannes Avoyan

Hovhannes Avoyan is the CEO of PicsArt, Inc.,

@ThingsExpo Stories
With an estimated 50 billion devices connected to the Internet by 2020, several industries will begin to expand their capabilities for retaining end point data at the edge to better utilize the range of data types and sheer volume of M2M data generated by the Internet of Things. In his session at @ThingsExpo, Don DeLoach, CEO and President of Infobright, will discuss the infrastructures businesses will need to implement to handle this explosion of data by providing specific use cases for filte...
Cognitive Computing is becoming the foundation for a new generation of solutions that have the potential to transform business. Unlike traditional approaches to building solutions, a cognitive computing approach allows the data to help determine the way applications are designed. This contrasts with conventional software development that begins with defining logic based on the current way a business operates. In her session at 18th Cloud Expo, Judith S. Hurwitz, President and CEO of Hurwitz & ...
SYS-CON Events announced today that VAI, a leading ERP software provider, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. VAI (Vormittag Associates, Inc.) is a leading independent mid-market ERP software developer renowned for its flexible solutions and ability to automate critical business functions for the distribution, manufacturing, specialty retail and service sectors. An IBM Premier Business Part...
Fortunately, meaningful and tangible business cases for IoT are plentiful in a broad array of industries and vertical markets. These range from simple warranty cost reduction for capital intensive assets, to minimizing downtime for vital business tools, to creating feedback loops improving product design, to improving and enhancing enterprise customer experiences. All of these business cases, which will be briefly explored in this session, hinge on cost effectively extracting relevant data from ...
SYS-CON Events announced today that Men & Mice, the leading global provider of DNS, DHCP and IP address management overlay solutions, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. The Men & Mice Suite overlay solution is already known for its powerful application in heterogeneous operating environments, enabling enterprises to scale without fuss. Building on a solid range of diverse platform support,...
As enterprises work to take advantage of Big Data technologies, they frequently become distracted by product-level decisions. In most new Big Data builds this approach is completely counter-productive: it presupposes tools that may not be a fit for development teams, forces IT to take on the burden of evaluating and maintaining unfamiliar technology, and represents a major up-front expense. In his session at @BigDataExpo at @ThingsExpo, Andrew Warfield, CTO and Co-Founder of Coho Data, will dis...
SYS-CON Events announced today that Pythian, a global IT services company specializing in helping companies adopt disruptive technologies to optimize revenue-generating systems, has been named “Bronze Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2015 at the Javits Center in New York, New York. Founded in 1997, Pythian is a global IT services company that helps companies compete by adopting disruptive technologies such as cloud, Big Data, advanced analytics, and DevO...
SYS-CON Events announced today that iDevices®, the preeminent brand in the connected home industry, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. iDevices, the preeminent brand in the connected home industry, has a growing line of HomeKit-enabled products available at the largest retailers worldwide. Through the “Designed with iDevices” co-development program and its custom-built IoT Cloud Infrastruc...
SYS-CON Events announced today that Alert Logic, Inc., the leading provider of Security-as-a-Service solutions for the cloud, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Alert Logic, Inc., provides Security-as-a-Service for on-premises, cloud, and hybrid infrastructures, delivering deep security insight and continuous protection for customers at a lower cost than traditional security solutions. Ful...
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2015 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 ad...
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management...
Eighty percent of a data scientist’s time is spent gathering and cleaning up data, and 80% of all data is unstructured and almost never analyzed. Cognitive computing, in combination with Big Data, is changing the equation by creating data reservoirs and using natural language processing to enable analysis of unstructured data sources. This is impacting every aspect of the analytics profession from how data is mined (and by whom) to how it is delivered. This is not some futuristic vision: it's ha...
With the Apple Watch making its way onto wrists all over the world, it’s only a matter of time before it becomes a staple in the workplace. In fact, Forrester reported that 68 percent of technology and business decision-makers characterize wearables as a top priority for 2015. Recognizing their business value early on, FinancialForce.com was the first to bring ERP to wearables, helping streamline communication across front and back office functions. In his session at @ThingsExpo, Kevin Roberts...
One of the bewildering things about DevOps is integrating the massive toolchain including the dozens of new tools that seem to crop up every year. Part of DevOps is Continuous Delivery and having a complex toolchain can add additional integration and setup to your developer environment. In his session at @DevOpsSummit at 18th Cloud Expo, Miko Matsumura, Chief Marketing Officer of Gradle Inc., will discuss which tools to use in a developer stack, how to provision the toolchain to minimize onboa...
The cloud promises new levels of agility and cost-savings for Big Data, data warehousing and analytics. But it’s challenging to understand all the options – from IaaS and PaaS to newer services like HaaS (Hadoop as a Service) and BDaaS (Big Data as a Service). In her session at @BigDataExpo at @ThingsExpo, Hannah Smalltree, a director at Cazena, will provide an educational overview of emerging “as-a-service” options for Big Data in the cloud. This is critical background for IT and data profes...
Silver Spring Networks, Inc. (NYSE: SSNI) extended its Internet of Things technology platform with performance enhancements to Gen5 – its fifth generation critical infrastructure networking platform. Already delivering nearly 23 million devices on five continents as one of the leading networking providers in the market, Silver Spring announced it is doubling the maximum speed of its Gen5 network to up to 2.4 Mbps, increasing computational performance by 10x, supporting simultaneous mesh communic...
SYS-CON Events announced today that Fusion, a leading provider of cloud services, will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. Fusion, a leading provider of integrated cloud solutions to small, medium and large businesses, is the industry's single source for the cloud. Fusion's advanced, proprietary cloud service platform enables the integration of leading edge solutions in the cloud, including clou...
Most people haven’t heard the word, “gamification,” even though they probably, and perhaps unwittingly, participate in it every day. Gamification is “the process of adding games or game-like elements to something (as a task) so as to encourage participation.” Further, gamification is about bringing game mechanics – rules, constructs, processes, and methods – into the real world in an effort to engage people. In his session at @ThingsExpo, Robert Endo, owner and engagement manager of Intrepid D...
WebRTC has had a real tough three or four years, and so have those working with it. Only a few short years ago, the development world were excited about WebRTC and proclaiming how awesome it was. You might have played with the technology a couple of years ago, only to find the extra infrastructure requirements were painful to implement and poorly documented. This probably left a bitter taste in your mouth, especially when things went wrong.
Learn how IoT, cloud, social networks and last but not least, humans, can be integrated into a seamless integration of cooperative organisms both cybernetic and biological. This has been enabled by recent advances in IoT device capabilities, messaging frameworks, presence and collaboration services, where devices can share information and make independent and human assisted decisions based upon social status from other entities. In his session at @ThingsExpo, Michael Heydt, founder of Seamless...