Welcome!

Linux Containers Authors: Sematext Blog, Elizabeth White, Liz McMillan, AppDynamics Blog, Akhil Sahai

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:

[[email protected] ~]# 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
SYS-CON Events announced today that LeaseWeb USA, a cloud Infrastructure-as-a-Service (IaaS) provider, will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. LeaseWeb is one of the world's largest hosting brands. The company helps customers define, develop and deploy IT infrastructure tailored to their exact business needs, by combining various kinds cloud solutions.
For basic one-to-one voice or video calling solutions, WebRTC has proven to be a very powerful technology. Although WebRTC’s core functionality is to provide secure, real-time p2p media streaming, leveraging native platform features and server-side components brings up new communication capabilities for web and native mobile applications, allowing for advanced multi-user use cases such as video broadcasting, conferencing, and media recording.
SYS-CON Events announced today that Venafi, the Immune System for the Internet™ and the leading provider of Next Generation Trust Protection, will exhibit at @DevOpsSummit at 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Venafi is the Immune System for the Internet™ that protects the foundation of all cybersecurity – cryptographic keys and digital certificates – so they can’t be misused by bad guys in attacks...
ReadyTalk has expanded the capabilities of the FoxDen collaboration platform announced late last year to include FoxDen Connect, an in-room video collaboration experience that launches with a single touch. With FoxDen Connect, users can now not only engage in HD video conferencing between iOS and Android mobile devices or Chrome browsers, but also set up in-person meeting rooms for video interactions. A host’s mobile device automatically recognizes the presence of a meeting room via beacon tech...
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
It’s 2016: buildings are smart, connected and the IoT is fundamentally altering how control and operating systems work and speak to each other. Platforms across the enterprise are networked via inexpensive sensors to collect massive amounts of data for analytics, information management, and insights that can be used to continuously improve operations. In his session at @ThingsExpo, Brian Chemel, Co-Founder and CTO of Digital Lumens, will explore: The benefits sensor-networked systems bring to ...
On Dice.com, the number of job postings asking for skill in Amazon Web Services increased 76 percent between June 2015 and June 2016. Salesforce.com saw its own skill mentions increase 37 percent, while DevOps and Cloud rose 35 percent and 28 percent, respectively. Even as they expand their presence in the cloud, companies are also looking for tech professionals who can manage projects, crunch data, and figure out how to make systems run more autonomously. Mentions of ‘data science’ as a skill ...
Manufacturers are embracing the Industrial Internet the same way consumers are leveraging Fitbits – to improve overall health and wellness. Both can provide consistent measurement, visibility, and suggest performance improvements customized to help reach goals. Fitbit users can view real-time data and make adjustments to increase their activity. In his session at @ThingsExpo, Mark Bernardo Professional Services Leader, Americas, at GE Digital, discussed how leveraging the Industrial Internet a...
Amazon has gradually rolled out parts of its IoT offerings in the last year, but these are just the tip of the iceberg. In addition to optimizing their back-end AWS offerings, Amazon is laying the ground work to be a major force in IoT – especially in the connected home and office. Amazon is extending its reach by building on its dominant Cloud IoT platform, its Dash Button strategy, recently announced Replenishment Services, the Echo/Alexa voice recognition control platform, the 6-7 strategic...
In addition to all the benefits, IoT is also bringing new kind of customer experience challenges - cars that unlock themselves, thermostats turning houses into saunas and baby video monitors broadcasting over the internet. This list can only increase because while IoT services should be intuitive and simple to use, the delivery ecosystem is a myriad of potential problems as IoT explodes complexity. So finding a performance issue is like finding the proverbial needle in the haystack.
There will be new vendors providing applications, middleware, and connected devices to support the thriving IoT ecosystem. This essentially means that electronic device manufacturers will also be in the software business. Many will be new to building embedded software or robust software. This creates an increased importance on software quality, particularly within the Industrial Internet of Things where business-critical applications are becoming dependent on products controlled by software. Qua...
Big Data, cloud, analytics, contextual information, wearable tech, sensors, mobility, and WebRTC: together, these advances have created a perfect storm of technologies that are disrupting and transforming classic communications models and ecosystems. In his session at @ThingsExpo, Erik Perotti, Senior Manager of New Ventures on Plantronics’ Innovation team, provided an overview of this technological shift, including associated business and consumer communications impacts, and opportunities it ...
The 19th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportuni...
IoT is rapidly changing the way enterprises are using data to improve business decision-making. In order to derive business value, organizations must unlock insights from the data gathered and then act on these. In their session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, and Peter Shashkin, Head of Development Department at EastBanc Technologies, discussed how one organization leveraged IoT, cloud technology and data analysis to improve customer experiences and effi...
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develo...
SYS-CON Events announced today that MangoApps will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. MangoApps provides modern company intranets and team collaboration software, allowing workers to stay connected and productive from anywhere in the world and from any device.
The IETF draft standard for M2M certificates is a security solution specifically designed for the demanding needs of IoT/M2M applications. In his session at @ThingsExpo, Brian Romansky, VP of Strategic Technology at TrustPoint Innovation, explained how M2M certificates can efficiently enable confidentiality, integrity, and authenticity on highly constrained devices.
“delaPlex Software provides software outsourcing services. We have a hybrid model where we have onshore developers and project managers that we can place anywhere in the U.S. or in Europe,” explained Manish Sachdeva, CEO at delaPlex Software, in this SYS-CON.tv interview at @ThingsExpo, held June 7-9, 2016, at the Javits Center in New York City, NY.
The IoT is changing the way enterprises conduct business. In his session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, discussed how businesses can gain an edge over competitors by empowering consumers to take control through IoT. He cited examples such as a Washington, D.C.-based sports club that leveraged IoT and the cloud to develop a comprehensive booking system. He also highlighted how IoT can revitalize and restore outdated business models, making them profitable ...
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 19th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world and ThingsExpo Silicon Valley Call for Papers is now open.