gearman

Changing Pecl installation directory

て烟熏妆下的殇ゞ 提交于 2019-12-01 08:36:54
问题 Hi i'm having trouble with pecl installation, the problem i'm having is i'm installing gearman , and i'm now at the stage of installation of the pecl PHP extension. it should be a simple as executing the command : $ sudo pecl install gearman the installation was successfull and I could even test a php containing <?php echo "Gearman version: " . gearman_version() . PHP_EOL; ?> executing it in CLI php using : $ php gearman_version.php does the trick. Unfortunately I am using a stack. lappstack

Gearman addTaskBackground complete Callback doesnot fire

泪湿孤枕 提交于 2019-12-01 08:20:37
问题 I am trying to make some job in background and write result to file result from complete callback, but its only work for addTask (not in background) and not for addTaskBackground have somebody any ideas? thanks for help! $client = new GearmanClient(); $client->addServer('localhost'); $client->setCompleteCallback("complete"); $client->addTaskBackground('upload', 'http://youtube.com/watch?v=o3mP3mJDL2k', null, 1); $client->addTaskBackground('upload', 'http://www.youtube.com/watch?v=SgAVnlnf8w0'

redis作为mysql的缓存服务器(读写分离)

拜拜、爱过 提交于 2019-11-30 23:05:51
一、redis简介 Redis是一个key-value存储系统。和Memcached类似,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。在部分场合可以对关系数据库起到很好的补充作用。它提供了Java,C/C++( hiredis ),C#,PHP,JavaScript,Perl,Object-C,Python,Ruby等客户端,使用很方便。 二、架构图 大致结构就是读写分离,将mysql中的数据通过触发器同步到redis中 三、安装LNMP环境 (这里为了省事,就是用yum来安装) 1、修改yum源 [root@redis ~]# vim /etc/yum.repos.d/epel.repo #添加这个文件 [epel] name=Extra Packages for Enterprise Linux 6 - $basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch failovermethod=priority enabled=1 gpgcheck=0 [nginx] name=nginx repo baseurl=http://nginx.org/packages

如何安装 gearmand 及对应的 php 扩展

时间秒杀一切 提交于 2019-11-30 23:05:41
1.安装依赖库 $ sudo apt-get install libboost-dev libboost-all-dev gperf* libevent-dev $ wget http://nchc.dl.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz $ tar zxvf libuuid-1.0.3.tar.gz $ cd libuuid-1.0.3/ $ ./configure $ sudo make $ sudo make install 2.安装 gearmand(主要是想安装 libgearman,安装 PHP 扩展时依赖它) $ wget https://launchpad.net/gearmand/1.2/1.1.12/+download/gearmand-1.1.12.tar.gz $ tar zxvf gearmand-1.1.12.tar.gz $ cd gearmand-1.1.12/ $ ./configure $ sudo make clean $ sudo make $ sudo make install $ sudo /sbin/ldconfig 3.安装 PHP 的 Gearman 扩展 $ wget http://pecl.php.net/get/gearman-1.1.2.tgz $

使用Gearman+Calabash并行测试手机APP

巧了我就是萌 提交于 2019-11-30 23:05:27
摘要 :使用任务分发系统Gearman分布式执行Calabash的自动化测试用例,可以达到并行测试手机APP的目的。 背景介绍 Gearman Gearman是一个分发任务的程序框架,可以用在各种场合,与Hadoop相比,Gearman更偏向于任务分发功能。它的 任务分布非常简单,简单得可以只需要用脚本即可完成。 Calabash Calabash-android是支持android的UI自动化测试框架,PC端使用了cucumber框架,通过http和json与模拟器和真机上安装的测试apk通信,测试apk调用robotium的方法来进行UI自动化测试,支持webview操作。 calabash脚本以 使用calabash测试开源中国Android客户端 为例。 Gearman安装和执行测试 Ubuntu上安装Gearman $ sudo apt-get install gearman-job-server $ gearmand -V gearmand 1.0.6 - https://bugs.launchpad.net/gearmand $ sudo apt-get install gearman-tools $ gearman -H 运行Gearman并发执行Calabash测试用例 启动gearman job server,作为后台服务运行: $ gearmand -d

GearmanWorker的多进程实现

自作多情 提交于 2019-11-30 23:05:01
前言 因为项目原因选择了gearman作为任务委派的中间件,但原生的python拓展包只支持单进程,期间为了将gearman改造成自适应多进程的方式在实现方式上走进了些误区,故在此记录这些误区的坑以及目前的最优解决方案。 实现思路 实现方式 主进程接收任务,子进程处理任务。以一个主进程作为任务委派的接收进程,接收到任务后将任务分派给子进程进行处理,处理完成后由该子进程直接返回任务结果给gearman。 多进程接收并处理任务。批量fork多个子进程注册任务,子进程间互不影响,各自完成接收、处理任务的过程。 先说说第一种实现方式的优缺点 优点: 由于worker较多的时间是消耗在等待接收请求上,因此主进程只单一的进行轮训任务接收可以提高单条gearman请求通道的利用率。 由子进程直接返回任务结果可分离主进程与子进程的作业,主进程无需关心任务的结果而只专注于接收任务。 缺点: 主进程接收到任务请求后将请求转发给子进程处理任务,由于子进程处理任务完成后需要将任务结果返回给gearman,因此子进程需要将该任务请求对应的gearman socket传递给子进程,而该过程实现起来过于复杂。(通常具有socket的实例无法通过pickle传递给子进程,虽然Unix的sendmsg可以用来传递socket,但将传递的socket构造成一个GearmanWorker又是另外一件痛苦的事情)

How to install Gearman with PHP Extension

◇◆丶佛笑我妖孽 提交于 2019-11-30 22:01:26
I'm trying to install Gearman with PHP Extension to use it with PHP-CLI. I have a Debian 6.0.5 with php5-cli and php-pear installed. Thats what I tried # apt-get install php5-dev # apt-get install gearman-job-server libgearman-dev # pecl install gearman Thats what I see on the console for pecl install downloading gearman-1.1.1.tgz ... Starting to download gearman-1.1.1.tgz (30,896 bytes) .........done: 30,896 bytes 3 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 building in /tmp/pear/temp/pear

How to install Gearman with PHP Extension

旧巷老猫 提交于 2019-11-30 17:47:44
问题 I'm trying to install Gearman with PHP Extension to use it with PHP-CLI. I have a Debian 6.0.5 with php5-cli and php-pear installed. Thats what I tried # apt-get install php5-dev # apt-get install gearman-job-server libgearman-dev # pecl install gearman Thats what I see on the console for pecl install downloading gearman-1.1.1.tgz ... Starting to download gearman-1.1.1.tgz (30,896 bytes) .........done: 30,896 bytes 3 source files, building running: phpize Configuring for: PHP Api Version:

Starting multiple upstart instances automatically

☆樱花仙子☆ 提交于 2019-11-30 10:20:31
问题 We use PHP gearman workers to run various tasks in parallel. Everything works just fine, and I have silly little shell script to spin them up when I want them. Being a programmer (and therefore lazy), I wanted to see if I could spin these up via an upstart script. I figured out how to use the instance stanza, so I could start them with an instance number: description "Async insert workers" author "Mike Grunder" env SCRIPT_PATH="/path/to/my/script" instance $N script php $SCRIPT_PATH/worker

Running Gearman Workers in the Background

坚强是说给别人听的谎言 提交于 2019-11-30 02:09:11
I'm using Ubuntu Natty with PHP 5.3.8. I just got Gearman working on my server. I did a few tests with some scripts I got off the PHP Manual, and everything works ok. However, I'd like to know if there's a way I can run the worker in the background, and also monitor it so that when I move to a multi-worker situation, I can keep track of just how many workers I've got working. Usually, I would have to open two terminals, one for the worker and one for the client. The one for the worker becomes 'stuck' in effect after the php script is executed. Thanks in advance. Ok. I found a solution to my