Memcached performance monitoring

Source: Internet
Author: User
Tags php web server vc9

In the preceding section. using memcached on the net platform, I will show you how to deploy the memecached server on the Windows platform. the Application of memcached In the. NET platform introduces in detail the configuration of two popular Client components, including storage, value, replacement, deletion, and cache time setting, advantages and disadvantages. In our testing project, we mainly aim at the application scenarios of "single server.

In fact, in our actual development, we often need multiple servers. In this way, we can form a true "distributed architecture" to better utilize the huge advantages of memcached. Of course, this is not an absolute advantage. No architecture can be absolutely perfect. Let's review the basic principle of memcached. In fact, it is to maintain a huge hash table in the memory. In layman's terms, data is cached in the server memory through key-value pairs to reduce the load on the database server. More importantly, the performance bottleneck of databases mainly lies in the I/o section (this is also the biggest weakness of relational databases. Although it has good stability, it faces the increasing number of users and massive data volumes, high concurrency and other problems are hard to cope. So in the past one or two years, many open-source teams and Technology enthusiasts have admired the "nosql" technology ). Anyone who knows a little about the computer knows that memory read/write is definitely much more efficient than disk I/O operations. But with memcached, can we abandon the traditional "Relational Database" completely? Of course not. memcached is not easy to use, but may reduce performance and cause fatal data loss.

Start to think about some problems,How is data stored when multiple memcached servers coexist? If data is synchronized in real time, how is the synchronization completed? Is it a server-side mechanism or a client-side operation? If it is distributed storage, after one of the servers goes down, will the data be lost? Also, how can we achieve "Load Balancing" for multiple memcached servers?

With these questions, start to enter the instance. Through repeated tests and monitoring, we can draw a conclusion. It is often more reliable than listening to others (some technologies or theories, even official mistakes or omissions ).


Here, we recommend two memcached performance monitoring tools. Through tools, we can clearly see how data is distributed in the memory of multiple servers, read/set operation times, and other information.

The first tool, named memcachedmanager, is http://download.csdn.net/detail/dinglang_2009/3843133.

This is a memcached management tool developed based on. NET technology. The interface is very simple and easy to operate. After the installation is downloaded, the directory is:

Replace memcached.exe (earlier version) in the binaryfilesdirectory with the latest version of memcached.exe ).

You can see the management tool interface:

The monitoring interface is as follows:

I am not familiar with this tool. I will not introduce it too much here. Interested readers can study it by themselves. I will introduce memadmin, a monitoring tool of another web version.

In fact, the command line provided by memcached can also monitor the parameter information, but it is not intuitive. These tools also provide interface display and operations by reading this information. We will not discuss it too much here. Interested readers can study the source code of the system in depth, you can even use a simple memcached monitoring tool like Zhou Gong.

Memadmin is a lightweight monitoring tool developed based on PhP5 & jquery technology. You can download it from its official website: http://www.junopen.com/memadmin /.

First download the latest PHP version (taking PHP 5.38 as an example). Because I use a Windows system, download it at http://windows.php.net/download. Of course, if you use a Linux operating system, you can download it at http://php.net/downloads.php. In this case, mongo.tar.gz is generally a compression format in Linux. You can use WinRAR to decompress it in windows, but there is no such information as "EXE" or "DLL" in windows. So it cannot be used. When the pen downloads memcached, the first download is a .tar.gz version. The consequences can be imagined.

I am using PHP 5.3 (5.3.8) vc9 x86 non thread safe (I actually use x64 Windows OS, but I can't find the x64 version of PHP, so it will be done ). Here, why do we need to mention this version? Later, when we configure the memcache_php.dll extension, we need to download the corresponding extension DLL based on the specific PHP version information.

PHP version 5.3.3 is now available for PHP, but several different versions are available for download. That is, vc6 x86 and vc9 x86. First, let me answer: What is vc6? Vc6 is compiled by the legacy Visual Studio 6 compiler. What is vc9? Vc9 is the Visual Studio 2008 compiler, which is compiled by Microsoft vs editor. So how do we choose which PHP version to download? If you are using Apache in windows, select vc6. If you are using IIS + PHP in windows, select vc9.

After downloading memadmin and PHP, configure the PHP Web server and deploy memadmin. In fact, readers can download and install Wamp Integration Development kits such as "appserver" to quickly integrate PHP, MySQL, and mysqladmin. However, I have long heard that in IIS 7.5, PHP can be run through CGI extension, and even Web servers such as Apache and tomcat can be integrated. The integration method is as follows:

First, it was relatively early to load the PHP environment in CGI Mode. The interpreter php.exe is also configured in iis. it was common in the early days and is rarely used at present. Features: stability, but low efficiency.

Second, the PHP environment is loaded using ISAPI, that is, the configuration interpreter in IIS is php5isapi. dll, which is currently the most widely used and widely used. Features: multithreading, high efficiency, but not stable enough.

In fact, there is also a more efficient way to integrate PHP and IIS, that is, using FastCGI to load the PHP environment.

Especially after Windows 7, FastCGI can be directly loaded in the IIS environment. This method is highly efficient and stable, and is a future development trend.

In PHP versions later than PhP 5.3, the ISAPI mode is not supported.

Step 1: extract the downloaded PHP compressed package to the root directory of the large C drive (you can decompress it to any directory), find the php. ini. devleper file, and rename it PHP. ini.

Second, download and install phpmanager. After installation, open IIS 7.5. If the following icon is displayed on the main panel of IIS, it indicates that phpmanager is successfully installed.

Then you can add PHP handler extensions. It is worth noting that the iis7.5 and IIS 6.0 interfaces and configurations are quite different. I have been using IIS 6.0 for many years and it was not quite suitable at the beginning.

Then find the FastCGI setting interface:

Create a common site in IIS, create an index. php file in the physical directory, and add the following code (print the current PHP information ):

<?phpphpinfo();?>

If the following page appears, PHP and IIS are configured.

Now, we will add a website directly pointing to the downloaded memadmin (the decompressed folder directory ). After adding the file, go to the following link:

The red message "PHP is used to install memcache extension..." appears ...". This is because the current PHP package does not have support and extensions for memcached. This tool cannot be initialized and cannot work (it cannot access and read data on the memcached server normally ). Okay, download the corresponding version at this address: http://downloads.php.net/pierre/

Have you seen it? There are two versions. Because the php5.3.8 we use is in the safe version of vc9 x86 non thread, we chose the one with the "CNT" above. (the author once downloaded the following version to make it unable to run, it took me lunch to take a nap ). After downloading the extension package, decompress it. It is actually a file named "php_memcahe.dll", copy the file to the ext folder under the PHP package directory, and then modify PHP. INI file, add a line "extension = php_memcache.dll ". Save. Restart the IIS service (iisreset), and then browse to view the memadmin logon interface.

After logging on to memadmin, you can add a memcached server for monitoring and management. The specific operation is very simple. Due to limited space, this article will only help you get started and teach you how to configure and use monitoring tools to help you explore and answer questions about memcached clusters, loads, and spof. In this way, the readers will be given a bit of free thinking and hands-on space. Next, I will use the monitoring tool to explore the data distribution algorithm in memcached, answer and summarize the questions mentioned above. Coming soon.

This article from the http://blog.csdn.net/dinglang_2009 reprint please indicate the source.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.