Gearman with XAMPP (windows)

669 views
Skip to first unread message

Vikas Gupta

unread,
Oct 7, 2014, 6:30:35 AM10/7/14
to gea...@googlegroups.com
Dear All,


First of all, sorry for bad English :(

I am new in Gearman in all respect..Few days back i come to know about Gearman with PHP to enhance performance and add task parallel.

I searched a lot but unable to get any thing, which help me to set the environment. I checked cygwin terminal but no luck. I user pear to insalll Net_gearman alpha  but do not know how may i use the same.

My system OS : Window 7 Ultimate, 64 Bit
Using XAMPP
PHP 5.5.11

Please help me out form this.


Thanks in Advance
 

 

Bogdan B

unread,
Oct 7, 2014, 6:55:48 AM10/7/14
to gea...@googlegroups.com
Hi Vikas,

The server part of Gearman has no windows implementation, as far as I know.
You will need a Linux virtual machine with the server installed. 

Using something like Vagrant will simplify the interaction with the VM.


--
You received this message because you are subscribed to the Google Groups "Gearman" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vikas Gupta

unread,
Oct 7, 2014, 7:02:00 AM10/7/14
to gea...@googlegroups.com
Thanks for your reply.

Ok, I will install on VM. But how may create worker in PHP and what are the changes required in PHP.ini so i can use gearman functions.

Bogdan B

unread,
Oct 7, 2014, 7:11:45 AM10/7/14
to gea...@googlegroups.com
A worker is just a script that needs to run continuously.

If you will use Vagrant it will automatically create a shared folder between your windows machine and VM so you will be able to ssh into the

I.e:
cd c:/workspace/project/
vagrant up
(best thing will be to install Ubuntu for VM, find a tutorial to install Gearman on Ubuntu)

At this point you will have the contents of project/ folder shared as /vagrant/ on your virtual machine so you can ssh in the VM and start a worker

vagrant ssh
php /vagrant/worker.php &

You will have a worker active and , using the ip of the VM, you can connect from XAMPP to the server and send client requests.

John Ewart

unread,
Oct 7, 2014, 10:05:42 AM10/7/14
to gea...@googlegroups.com
The Java server implementations should be able run on Windows with any recent JVM without issue; there are two of them - mine (github.com/johnewart/gearman-java) which I'm actively working on when people find bugs or features they want, and the java-gearman-service project (which I don't think has seen an update in a long time). 

-John

Vikas Gupta

unread,
Oct 8, 2014, 9:02:05 AM10/8/14
to gea...@googlegroups.com

@Bogdan:

I agreed on this. One worker will runs on. 

My concern is. How PHP client will allocate work to worker? for that we need to enable gearman library at client side.

Else how we can set the priority and all.


Please correct me, if i am wrong.

--
You received this message because you are subscribed to a topic in the Google Groups "Gearman" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gearman/D8Ju2FDkQ8U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gearman+u...@googlegroups.com.

Bogdan B

unread,
Oct 8, 2014, 9:35:24 AM10/8/14
to gea...@googlegroups.com
When a worker starts it notifies the server about what he knows to do (from docs):

$worker = new GearmanWorker();
$worker->addServer();
$worker->addFunction("reverse", function ($job) {
  return strrev($job->workload());
});

When you're doing a client request you're telling the server what you need to run:

$client = new GearmanClient();
$client->addServer();
print $client->do("reverse", "Hello World!");

At this point the server knows your what worker is able to process 'reverse' jobs so it will send the work to it, you don't have to do anything.

What you need to do is (simplified version):
1. start the server
2. start the workers
3. do the client requests :)


Vikas Gupta

unread,
Oct 10, 2014, 12:43:55 AM10/10/14
to gea...@googlegroups.com
Great ...

So, I do not need to include any Gearman Client library for creating object to add server and all. 

Let me follow your steps ... and will share you the output.

Thanks
Vikas Gupta


Vikas Gupta

unread,
Oct 10, 2014, 1:05:18 AM10/10/14
to gea...@googlegroups.com
As instruction, i wrote gearman client code that gives me

Fatal error: Class 'GearmanClient' not found. :( :(
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Gearman" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gearman/D8Ju2FDkQ8U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gearman+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Gearman" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gearman+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Gearman" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gearman/D8Ju2FDkQ8U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gearman+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages