What is Gearman?Gearman provides a generic application framework to farm off work to other machines or processes that is better suited to Do the work. It allows your to do work in parallel, to the load balance processing, and to the call functions
A related introductionIntroduction to multi-server data sharing with 1.memcache + memcache, see http://www.guigui8.com/index.php/archives/206.html
2.session Mechanism:The session mechanism is a server-side mechanism that uses a hash-like structure (
Class Memcachemodel {
Private $MC = null;
/**
* Construction method for adding servers and creating memcahced objects
*/
function __construct () {
$params = Func_get_args ();
$MC = new Memcache;
If there are
Memcach is a powerful tool for improving the performance of web applications and Drupal applications. Recently, Memcache has been used to find many minor problems. Therefore, the author has summarized several issues for your reference.1. Differences
PHP with memcached is already a standard for including women. Again, it seems to make people feel too "?" , but there are some details not everyone is clear, such as pecl there are two memcached modules, Memcache and memcached, most of the current
The previous articles mentioned memcache and TT. memcache memory databases are well understood. data is stored in the memory, and data is lost when the server is restarted or the memcahce process is restarted. So we also mentioned that ttserver data
If yii fails to connect to memcache under the default configuration, an error is reported. To implement failover, You need to modify the configuration and code.
1. First, modify yii's caching/cmemcache. php. My version is 1.1.7.
Find
$ Cache->
Introduction to gearman
Home page in http://gearman.org/index.php, its main advantagesInclude:1.Asynchronous computing. You can allocate time-consuming computing to distributed computing clusters to reduce the pressure on site servers and user waits.
Next article: mysql uses mysql-udf-http Efficiency Test notes. Instead of using the rest architecture, this time it uses libmemcached and memcached_functions_mysql. The test version is:
Libmemcached-0.34.tar.gzand
The php sessions on the web server are all sent to memcached, so that no matter which web server you allocate the ip connection to by the distributor, there will be no problem. The configuration method is very simple, just in the php configuration
Install Gearman on centos
I. Introduction
Gearman is installed in two steps. Step 2 is gearmand installation, and step 2 is the PHP extension installation of gearman.
Step 2:
2. Installation of gearmand
1. First install libdrizzle
# Yum install
Transferred from www.5iphp.com
Memcache: getversion
StringMemcache: getversion(Void)
Note:
Returns the version information of the running memcache instance. Same Function memcache_get_version ()
Return Value:
The version of the server is
Distributing workloads for PHP applications with Gearman
http://www.ibm.com/developerworks/cn/opensource/os-php-gearman/
Using Gearman from PHP
Using Gearman from PHP is similar to the previous example, the only difference being that this is the
After an afternoon of doing:Develop the server program. The server-side code framework needs to be generated using gSOAP.We have two ways to do this:
Write the WSDL, use wsdl2h to generate the header file, and then soapcpp2 generate the
PHP/*** Distributed Memcache set implementation*//*** Create a cache implementation Memcache add a distributed server and set permissions*/functionCreatecache () {$arr=Array( Array("Host" = "127.0.0.1", "port" = 11211, "weight" = 20),//127.0.0
1. Most PHP environments currently use memcache versions with no D, this version is earlier and is a native version, developed entirely within the PHP framework. The corresponding memcached with D is based on the libmemcached, so the memcached
Example
The code is as follows
Copy Code
$mem = new Memcache;$mem->connect (' 127.0.0.1 ', 11211) or die ("could not Connect");$mem->set (' key ', ' This is a test! ', 0, 60);$val = $mem->get (' key ');Echo $val;?>
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.