unmk2 / jaxl

Automatically exported from code.google.com/p/jaxl
GNU General Public License v3.0
0 stars 0 forks source link

how to reduce many php.exe process to just one process (multi-instance jaxl application) #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using jaxl to create a multi instance jaxl application , i mean i have jaxl 
script hosted on a server  and i have many clients which log in using the same 
jaxl command line application , so each time someone logs in it create one 
php.exe process , so there are many php.exe processes . 

Is there any way i can achieve the same thing , by only activating one php.exe 
instance .

Original issue reported on code.google.com by gyl.rajat on 24 Dec 2010 at 11:30

GoogleCodeExporter commented 9 years ago
Hi Rajat,

Your application is not exactly a multi-instance jaxl app as it creates a 
separate php process for each connecting jabber user. It more of a single jaxl 
instance per php process application.

You can very well run multipe jaxl instances within a php process. However to 
achieve this you will have to write your own controller and replace it with 
what $jaxl->startCore('stream') do for you.

Controller can vary from app to app depending upon the needs. Here is a simple 
approach i follow to run multiple jaxl instance inside a php process:
1) Create a master Jaxl instance with $jaxl = new JAXL();
2) Add callback required for master instance using $jaxl->addPlugin
3) One necessary callback should be for jaxl_get_xml hook. With this your 
application method gain control whenever your master instance has received xmpp 
payload from connected stream
4) Inside this callback you can create and read stream for new Jaxl instances. 
Generally creation process which is only ($jaxl_1 = new JAXL()) can be done out 
of this callback

With 2.1.2 release I am planning to include a multi-instance jaxl application 
inside /app folder. Also trying to come up with a 
$jaxl->startMultiCore('stream') method, with which developers can stop 
bothering about dirty jaxl_get_xml handling, it can very well be handled inside 
the core itself.

I have cc'ed Andrie Bastun to this issue. He can probably help you further with 
his own experiences.

Original comment by mailsfor...@gmail.com on 27 Dec 2010 at 10:41

GoogleCodeExporter commented 9 years ago
Thanks for the detailed reply , i understood some part of what you tried to 
explain but some part remains alien to me . i will try to get help from Andrie 
Bastun , 

What is you estimated time for the release of 2.1.2 with all these methods ?. 

Original comment by gyl.rajat on 27 Dec 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Hi Rajat,

I checked in the code (few weeks back) which can be used to run multiple 
instances inside the same PHP process. Kindly checkout the latest from jaxl 
master and let me know if it helps you out.

Use:
$jaxl->addCore($jaxl_new_instance);

Original comment by mailsfor...@gmail.com on 18 Jan 2011 at 10:47

GoogleCodeExporter commented 9 years ago

Original comment by mailsfor...@gmail.com on 7 Feb 2011 at 5:22