Re: How to start/stop XML-RPC server?

David Luu <[email protected]> Tue, 25 Dec 2012 10:38:41 -0800
Newsgroups gmane.comp.php.xml-rpc
Message-ID <CA+V6+ZBcxyaD4gh-U3Yxc_W0wfOGG1cxb9bT+8wtxrM0+8ePog@mail.gmail.com>
--===============6723064119911602953==
Content-Type: multipart/alternative; boundary=f46d043894277c4b5404d1b19fc2

--f46d043894277c4b5404d1b19fc2
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Thanks for the response Ken. Sorry, guess I wasn't too clear about my
question, part of my question is also about the lifecycle of the XML-RPC
server. Your response was rather generic in terms of PHP and not XML-RPC
"server" via PHP.

With other languages where the HTTP server is bundled/built into the
XML-RPC server, the lifecycle is you start up server, that's the instance
of the server and it ends when you shut down the server. During its
lifecycle/operation, all requests to the server go through the same XML-RPC
server instance.

From your response and a re-looking at the code, I'm using these as
reference

http://phpxmlrpc.sourceforge.net/server.php?showSource=3DTRUE
PHP XML-RPC server doc: http://phpxmlrpc.sourceforge.net/doc-2/ch07s05.html

It appears the lifecycle is the "XML-RPC server" is initialized on an HTTP
request to any PHP page that invokes the "XML-RPC server" (whether directly
in the page code or via code in include file), and that the server sorta
stops after it completes the HTTP response back to the requesting client?
Because otherwise, the PHP module on the HTTP server would keep spawning
XML-RPC server instances if its lifecycle didn't end with the response
being sent back (memory leak, etc.), unless of course the PHP module knew
to reuse the server on subsequent requests.

David

On Tue, Dec 25, 2012 at 3:35 AM, Ken Almond <[email protected]>wrot=
e:

> Hi
>
>
>
> Apache (when configured) loads a php.so module =96 so PHP is =91loaded=92=
 (ready
> to go) as part of apache startup.
>
> Yes, when HTTP hits Apache, the server.php file is loaded (on each HTTP
> request).     Since php.so module is already running as part of apache
> startup =96 its =91very fast=92 BUT you do want to keep server.php files =
smaller
> (1,000(s) of lines) instead of 50,000(s) of lines.     We used a URL name
> space to have multiple server.php files =96 e.g.    http://host/login.php
> (login.php is a server.php file),   http://host/accounts.php,   etc. -
> e.g. 1 =91server.php=92 for grouping of web services.   The login.php and
> account.php, and x.php and y.php can call into shared library.php(s) but
> again, overall, keep the #includes smaller so each server.php is not =91t=
oo
> large=92.     We achieved average 10ms (where php called MSSQL inside)
> response time for 1,000(s) of simultaneous users on single apache server.
>
>
>
> Bonus tip
>
> We put 1st apache server in DNZ zone (publically available for URL) and
> then used apache reverse proxy over to internal apache that that actually
> called the server.php(s) for very strong protection.    Worked very
> well.     Then as we grew, we used the reverse proxy to load balance =96 =
but
> apache also has other forms of load balance.
>
>
>
> Good Luck
>
> Ken
>
>
>
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *David Luu
> *Sent:* Monday, December 24, 2012 10:35 PM
> *To:* [email protected]
> *Subject:* [phpxmlrpc] How to start/stop XML-RPC server?
>
>
>
> I'm just looking into XML-RPC server with PHP, so have not much idea abou=
t
> its implementation and design.
>
>
>
> With other language implementations, it's easy to understand, as you can
> start/stop the server from command line (or other interface like UI,
> XML-RPC call for stop, etc.) as all the server functionality can be
> combined with the XML-RPC server itself as a single self contained
> binary/application.
>
>
>
> With PHP, the PHP code is served by a web/application server. So wanted
> some clarification:
>
>
>
> * how do you start the server? Start up the web/application server
> (Apache, IIS, etc.), then hit the URL to the PHP script that creates the
> server instance? Are the XML-RPC requests (different XML-RPC method calls=
)
> going to same URL or different one?
>
>
>
> * how do you stop the PHP XML-RPC server? Stop the web/application server
> itself? (e.g. Apache, IIS, etc.) Or is there a way to stop it w/o turning
> off the whole web/application server or say killing PHP.
>
>
>
> David
>

--f46d043894277c4b5404d1b19fc2
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<div>Thanks for the response Ken. Sorry, guess I wasn&#39;t too clear about=
 my question, part of my question is also about the lifecycle of the XML-RP=
C server. Your response was rather generic in terms of PHP and not XML-RPC =
&quot;server&quot; via PHP.<br>
</div><div><br></div><div>With other languages where the HTTP server is bun=
dled/built into the XML-RPC server, the lifecycle is you start up server, t=
hat&#39;s the instance of the server and it ends when you shut down the ser=
ver. During its lifecycle/operation, all requests to the server go through =
the same XML-RPC server instance.</div>
<div><br></div><div>From your response and a re-looking at the code, I&#39;=
m using these as reference</div><div><br></div><div><a href=3D"http://phpxm=
lrpc.sourceforge.net/server.php?showSource=3DTRUE">http://phpxmlrpc.sourcef=
orge.net/server.php?showSource=3DTRUE</a></div>
<div>PHP XML-RPC server doc: <a href=3D"http://phpxmlrpc.sourceforge.net/do=
c-2/ch07s05.html">http://phpxmlrpc.sourceforge.net/doc-2/ch07s05.html</a></=
div><div><br></div><div>It appears the lifecycle is the &quot;XML-RPC serve=
r&quot; is initialized on an HTTP request to any PHP page that invokes the =
&quot;XML-RPC server&quot; (whether directly in the page code or via code i=
n include file), and that the server sorta stops after it completes the HTT=
P response back to the requesting client? Because otherwise, the PHP module=
 on the HTTP server would keep spawning XML-RPC server instances if its lif=
ecycle didn&#39;t end with the response being sent back (memory leak, etc.)=
, unless of course the PHP module knew to reuse the server on subsequent re=
quests.</div>
<div><br></div><div>David</div><br><div class=3D"gmail_quote">On Tue, Dec 2=
5, 2012 at 3:35 AM, Ken Almond <span dir=3D"ltr">&lt;<a href=3D"mailto:ken@=
almondenterprises.com" target=3D"_blank">[email protected]</a>&gt;<=
/span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div lang=3D"EN-US" link=3D"blue" vlink=3D"p=
urple"><div><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-fam=
ily:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1f497d">Hi</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">=A0</span></p><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;=
,&quot;sans-serif&quot;;color:#1f497d">Apache (when configured) loads a php=
.so module =96 so PHP is =91loaded=92 (ready to go) as part of apache start=
up.</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">Yes, when HTTP hits Apach=
e, the server.php file is loaded (on each HTTP request).=A0=A0=A0=A0 Since =
php.so module is already running as part of apache startup =96 its =91very =
fast=92 BUT you do want to keep server.php files smaller (1,000(s) of lines=
) instead of 50,000(s) of lines.=A0=A0=A0=A0 We used a URL name space to ha=
ve multiple server.php files =96 e.g.=A0=A0=A0 <a href=3D"http://host/login=
.php" target=3D"_blank">http://host/login.php</a>=A0 (login.php is a server=
.php file),=A0=A0 <a href=3D"http://host/accounts.php" target=3D"_blank">ht=
tp://host/accounts.php</a>,=A0=A0 etc. -=A0 e.g. 1 =91server.php=92 for gro=
uping of web services.=A0=A0 The login.php and account.php, and x.php and y=
.php can call into shared library.php(s) but again, overall, keep the #incl=
udes smaller so each server.php is not =91too large=92.=A0=A0=A0=A0 We achi=
eved average 10ms (where php called MSSQL inside) response time for 1,000(s=
) of simultaneous users on single apache server.</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">=A0</span></p><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;=
,&quot;sans-serif&quot;;color:#1f497d">Bonus tip</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">We put 1<sup>st</sup> apa=
che server in DNZ zone (publically available for URL) and then used apache =
reverse proxy over to internal apache that that actually called the server.=
php(s) for very strong protection.=A0=A0=A0 Worked very well.=A0=A0=A0=A0 T=
hen as we grew, we used the reverse proxy to load balance =96 but apache al=
so has other forms of load balance.</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">=A0</span></p><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;=
,&quot;sans-serif&quot;;color:#1f497d">Good Luck</span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1f497d">Ken</span></p><p class=3D=
"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;=
,&quot;sans-serif&quot;;color:#1f497d">=A0</span></p>
<p class=3D"MsoNormal"><b><span style=3D"font-size:10.0pt;font-family:&quot=
;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style=3D"font-s=
ize:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> <a href=
=3D"mailto:[email protected]" target=3D"_blank">phpxmlr=
[email protected]</a> [mailto:<a href=3D"mailto:phpxmlrpc-boun=
[email protected]" target=3D"_blank">[email protected]=
c.com</a>] <b>On Behalf Of </b>David Luu<br>
<b>Sent:</b> Monday, December 24, 2012 10:35 PM<br><b>To:</b> <a href=3D"ma=
ilto:[email protected]" target=3D"_blank">[email protected]=
linc.com</a><br><b>Subject:</b> [phpxmlrpc] How to start/stop XML-RPC serve=
r?</span></p>
<div><div class=3D"h5"><p class=3D"MsoNormal">=A0</p><div><p class=3D"MsoNo=
rmal">I&#39;m just looking into XML-RPC server with PHP, so have not much i=
dea about its implementation and design.</p></div><div><p class=3D"MsoNorma=
l">=A0</p>
</div><div><p class=3D"MsoNormal">With other language implementations, it&#=
39;s easy to understand, as you can start/stop the server from command line=
 (or other interface like UI, XML-RPC call for stop, etc.) as all the serve=
r functionality can be combined with the XML-RPC server itself as a single =
self contained binary/application.</p>
</div><div><p class=3D"MsoNormal">=A0</p></div><div><p class=3D"MsoNormal">=
With PHP, the PHP code is served by a web/application server. So wanted som=
e clarification:</p></div><div><p class=3D"MsoNormal">=A0</p></div><div><p =
class=3D"MsoNormal">
* how do you start the server? Start up the web/application server (Apache,=
 IIS, etc.), then hit the URL to the PHP script that creates the server ins=
tance? Are the XML-RPC requests (different XML-RPC method calls) going to s=
ame URL or different one?</p>
</div><div><p class=3D"MsoNormal">=A0</p></div><div><p class=3D"MsoNormal">=
* how do you stop the PHP XML-RPC server? Stop the web/application server i=
tself? (e.g. Apache, IIS, etc.) Or is there a way to stop it w/o turning of=
f the whole web/application server or say killing PHP.</p>
</div><div><p class=3D"MsoNormal">=A0</p></div><div><p class=3D"MsoNormal">=
David</p></div></div></div></div></div></blockquote></div><br>

--f46d043894277c4b5404d1b19fc2--

--===============6723064119911602953==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
phpxmlrpc mailing list
[email protected]
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc

--===============6723064119911602953==--