RE: [PHP] Running a server process

2007-08-11 Thread Nathan Wallis
Thanks for the info guys.

Sockets sound interesting.  Will check the out more.

I have played with sockets and flash before, but I will read up more.

From what you are saying I gather that 500 people with an open socket to the
program is a lot different to 500 people spawning their own process.

Thanks again,

Nathan


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 11, 2007 10:10 AM
To: Nathan Wallis
Cc: php-general@lists.php.net
Subject: Re: [PHP] Running a server process

On Fri, August 10, 2007 6:26 am, Nathan Wallis wrote:
 I have a windows application the performs  a certain task that I need
 it to
 perform.  I am in the process of developing my site and am really
 interested
 in the functionality of the site at the moment and haven't set about
 putting
 the details in place, so I am using the php function

 exec (start ... );

 To run the process.

 It works.

 That is it works with just me using the site.  I am wondering how this
 would
 effect performance if say 500 people were executing this php function
 around
 the same time and the processing overlapped.

Don't wonder.

Run ab (Apache Benchmark) and find out.

Or use valgrind/callgrind to find out.

Or use wget to find out.

Or use that whack-a-mole benchmark or SuperSmack or whatever it is.

 Is there anyway to make
 an
 executable run as a service, I am guessing at the terminology that I
 should
 use here, but I feel there would be a much more efficient way of
 performing
 this task.

Any program can be run as a service (Un*x: daemon)

Writing that program to do something useful and, more so, efficient,
is a bit challenging.

Here's a sample talkback service that just spits out whatever you
put in:
http://php.net/sockets

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)

http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut

Well stut, this doesn't really run your program as a service.
The program itself is a server, and simply starts every program when
that service starts. That's not the same as running the program as a
service.

That's extremely pedantic. As a service simply means it responds to
messages from the OS such as start, pause and stop. Firedaemon wraps
your executable in a process that does just that. So technically you're
correct, it doesn't turn your executable into a service, it wraps it in
one, but the effect is essentially the same.

If you need the extra control you'll get over it by rewriting your
executable to actually be a service then you should do that. But if
you're working with something you don't have the source for, or don't
have the time to implement such a modification then Firedaemon is the
best option I've come across.

-Stut


Yes, but if you don't have the source, you can't add socket support,
and then you can do quite less with a program... Unless you already
have socket support in the program, but that seems quite odd to me ;)


 Sockets aren't the only IPC mechanism available. And besides, I was 
countering your general statement regarding Firedaemon, not the 
applicability of Firedaemon to the OP's problem, which we can't comment 
on without knowing a lot more information about it.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Stut [EMAIL PROTECTED] wrote:

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)

http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut


Well stut, this doesn't really run your program as a service.
The program itself is a server, and simply starts every program when
that service starts. That's not the same as running the program as a
service.


That's extremely pedantic. As a service simply means it responds to 
messages from the OS such as start, pause and stop. Firedaemon wraps 
your executable in a process that does just that. So technically you're 
correct, it doesn't turn your executable into a service, it wraps it in 
one, but the effect is essentially the same.


If you need the extra control you'll get over it by rewriting your 
executable to actually be a service then you should do that. But if 
you're working with something you don't have the source for, or don't 
have the time to implement such a modification then Firedaemon is the 
best option I've come across.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Tijnema
On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:
  That is it works with just me using the site.  I am wondering how this would
  effect performance if say 500 people were executing this php function around
  the same time and the processing overlapped.  Is there anyway to make an
  executable run as a service, I am guessing at the terminology that I should
  use here, but I feel there would be a much more efficient way of performing
  this task.

 Well, ideally you don't run an executable. But if you must, there's some
 Windows program that turns an executable into a service. But then
 there's the consideration of communicating with it, which you could do
 with sockets. Or you could use a file.

 --
 Richard Heyes
 +44 (0)844 801 1072
 http://www.websupportsolutions.co.uk

I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)

Tijnema


-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Tijnema
On 8/10/07, Stut [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:
  That is it works with just me using the site.  I am wondering how this 
  would
  effect performance if say 500 people were executing this php function 
  around
  the same time and the processing overlapped.  Is there anyway to make an
  executable run as a service, I am guessing at the terminology that I 
  should
  use here, but I feel there would be a much more efficient way of 
  performing
  this task.
  Well, ideally you don't run an executable. But if you must, there's some
  Windows program that turns an executable into a service. But then
  there's the consideration of communicating with it, which you could do
  with sockets. Or you could use a file.
 
  --
  Richard Heyes
  +44 (0)844 801 1072
  http://www.websupportsolutions.co.uk
 
  I don't know if there a program exists that can convert the program
  to a service, I think you need to compile it as a service from source
  code, but as I mentioned in my first post, and you mentioned here too,
  you also need to add support for a socket server in your program.
  Sockets in PHP are easy ;)

 http://www.firedaemon.com/

 But you're right, you'd need a way to communicate with the service.

 -Stut

Well stut, this doesn't really run your program as a service.
The program itself is a server, and simply starts every program when
that service starts. That's not the same as running the program as a
service.

Tijnema

-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Tijnema
On 8/10/07, Stut [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 8/10/07, Stut [EMAIL PROTECTED] wrote:
  Tijnema wrote:
  On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:
  That is it works with just me using the site.  I am wondering how this 
  would
  effect performance if say 500 people were executing this php function 
  around
  the same time and the processing overlapped.  Is there anyway to make an
  executable run as a service, I am guessing at the terminology that I 
  should
  use here, but I feel there would be a much more efficient way of 
  performing
  this task.
  Well, ideally you don't run an executable. But if you must, there's some
  Windows program that turns an executable into a service. But then
  there's the consideration of communicating with it, which you could do
  with sockets. Or you could use a file.
 
  --
  Richard Heyes
  +44 (0)844 801 1072
  http://www.websupportsolutions.co.uk
  I don't know if there a program exists that can convert the program
  to a service, I think you need to compile it as a service from source
  code, but as I mentioned in my first post, and you mentioned here too,
  you also need to add support for a socket server in your program.
  Sockets in PHP are easy ;)
  http://www.firedaemon.com/
 
  But you're right, you'd need a way to communicate with the service.
 
  -Stut
 
  Well stut, this doesn't really run your program as a service.
  The program itself is a server, and simply starts every program when
  that service starts. That's not the same as running the program as a
  service.

 That's extremely pedantic. As a service simply means it responds to
 messages from the OS such as start, pause and stop. Firedaemon wraps
 your executable in a process that does just that. So technically you're
 correct, it doesn't turn your executable into a service, it wraps it in
 one, but the effect is essentially the same.

 If you need the extra control you'll get over it by rewriting your
 executable to actually be a service then you should do that. But if
 you're working with something you don't have the source for, or don't
 have the time to implement such a modification then Firedaemon is the
 best option I've come across.

 -Stut

Yes, but if you don't have the source, you can't add socket support,
and then you can do quite less with a program... Unless you already
have socket support in the program, but that seems quite odd to me ;)

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Tijnema
On 8/10/07, Stut [EMAIL PROTECTED] wrote:
 Tijnema wrote:
  On 8/10/07, Stut [EMAIL PROTECTED] wrote:
  Tijnema wrote:
  On 8/10/07, Stut [EMAIL PROTECTED] wrote:
  Tijnema wrote:
  On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:
  That is it works with just me using the site.  I am wondering how 
  this would
  effect performance if say 500 people were executing this php function 
  around
  the same time and the processing overlapped.  Is there anyway to make 
  an
  executable run as a service, I am guessing at the terminology that I 
  should
  use here, but I feel there would be a much more efficient way of 
  performing
  this task.
  Well, ideally you don't run an executable. But if you must, there's 
  some
  Windows program that turns an executable into a service. But then
  there's the consideration of communicating with it, which you could do
  with sockets. Or you could use a file.
 
  --
  Richard Heyes
  +44 (0)844 801 1072
  http://www.websupportsolutions.co.uk
  I don't know if there a program exists that can convert the program
  to a service, I think you need to compile it as a service from source
  code, but as I mentioned in my first post, and you mentioned here too,
  you also need to add support for a socket server in your program.
  Sockets in PHP are easy ;)
  http://www.firedaemon.com/
 
  But you're right, you'd need a way to communicate with the service.
 
  -Stut
  Well stut, this doesn't really run your program as a service.
  The program itself is a server, and simply starts every program when
  that service starts. That's not the same as running the program as a
  service.
  That's extremely pedantic. As a service simply means it responds to
  messages from the OS such as start, pause and stop. Firedaemon wraps
  your executable in a process that does just that. So technically you're
  correct, it doesn't turn your executable into a service, it wraps it in
  one, but the effect is essentially the same.
 
  If you need the extra control you'll get over it by rewriting your
  executable to actually be a service then you should do that. But if
  you're working with something you don't have the source for, or don't
  have the time to implement such a modification then Firedaemon is the
  best option I've come across.
 
  -Stut
 
  Yes, but if you don't have the source, you can't add socket support,
  and then you can do quite less with a program... Unless you already
  have socket support in the program, but that seems quite odd to me ;)

  Sockets aren't the only IPC mechanism available. And besides, I was
 countering your general statement regarding Firedaemon, not the
 applicability of Firedaemon to the OP's problem, which we can't comment
 on without knowing a lot more information about it.

 -Stut

Sockets is the best IPC available for all platforms, Pipes etc. only
work on POSIX systems, not on default windows installation, as you
would need the Microsoft Windows Services For Unix package installed.

You could use things like files or databases too, but sockets would
mostly be easier as you can simple send a START command to emulate the
start of a program, and have a stream open for returning data.

I see I misreaded a little bit of your reply.

Tijnema

-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Daniel Brown
On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:
  That is it works with just me using the site.  I am wondering how this would
  effect performance if say 500 people were executing this php function around
  the same time and the processing overlapped.  Is there anyway to make an
  executable run as a service, I am guessing at the terminology that I should
  use here, but I feel there would be a much more efficient way of performing
  this task.

 Well, ideally you don't run an executable. But if you must, there's some
 Windows program that turns an executable into a service. But then
 there's the consideration of communicating with it, which you could do
 with sockets. Or you could use a file.

 --
 Richard Heyes
 +44 (0)844 801 1072
 http://www.websupportsolutions.co.uk

 Knowledge Base and HelpDesk software
 that can cut the cost of online support

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Nathan,

It should also be noted that, if your question was also whether or
not two perfectly-simultaneous executions by two separate clients is
an issue, the answer is no.  Even if you had all 500 clients hitting
the exec() point at the exact same moment, PID tracking wouldn't be an
issue for even a semi-modern machine.  Resource usage probably would
be, and there would be the issue of PID limitation if you're hitting
the magic number (65535), but for the system to accurately track which
data goes to which client and who owns what process.

I'm not sure if that's even part of the point you were
questioning, but I read it as such.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Richard Heyes

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.


Well, ideally you don't run an executable. But if you must, there's some 
Windows program that turns an executable into a service. But then 
there's the consideration of communicating with it, which you could do 
with sockets. Or you could use a file.


--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Tijnema
On 8/10/07, Nathan Wallis [EMAIL PROTECTED] wrote:
 Hi there,



 I have a windows application the performs  a certain task that I need it to
 perform.  I am in the process of developing my site and am really interested
 in the functionality of the site at the moment and haven't set about putting
 the details in place, so I am using the php function



 exec (start ... );



 To run the process.



 It works.



 That is it works with just me using the site.  I am wondering how this would
 effect performance if say 500 people were executing this php function around
 the same time and the processing overlapped.  Is there anyway to make an
 executable run as a service, I am guessing at the terminology that I should
 use here, but I feel there would be a much more efficient way of performing
 this task.



 Any thoughts would be much appreciated.



 Nathan

500 people at the same time is a big problem, as it will start 500
processes at the same time. I wonder how many Windows servers can
handle that much processes at same time.

If you have written the windows application, you should rewrite some
part of it to let it work with sockets, so that you can simply connect
to the program with a socket.

Tijnema
-- 
Vote for PHP Color Coding in Gmail! - http://gpcc.tijnema.info

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Stut

Tijnema wrote:

On 8/10/07, Richard Heyes [EMAIL PROTECTED] wrote:

That is it works with just me using the site.  I am wondering how this would
effect performance if say 500 people were executing this php function around
the same time and the processing overlapped.  Is there anyway to make an
executable run as a service, I am guessing at the terminology that I should
use here, but I feel there would be a much more efficient way of performing
this task.

Well, ideally you don't run an executable. But if you must, there's some
Windows program that turns an executable into a service. But then
there's the consideration of communicating with it, which you could do
with sockets. Or you could use a file.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk


I don't know if there a program exists that can convert the program
to a service, I think you need to compile it as a service from source
code, but as I mentioned in my first post, and you mentioned here too,
you also need to add support for a socket server in your program.
Sockets in PHP are easy ;)


http://www.firedaemon.com/

But you're right, you'd need a way to communicate with the service.

-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Running a server process

2007-08-10 Thread Richard Lynch
On Fri, August 10, 2007 6:26 am, Nathan Wallis wrote:
 I have a windows application the performs  a certain task that I need
 it to
 perform.  I am in the process of developing my site and am really
 interested
 in the functionality of the site at the moment and haven't set about
 putting
 the details in place, so I am using the php function

 exec (start ... );

 To run the process.

 It works.

 That is it works with just me using the site.  I am wondering how this
 would
 effect performance if say 500 people were executing this php function
 around
 the same time and the processing overlapped.

Don't wonder.

Run ab (Apache Benchmark) and find out.

Or use valgrind/callgrind to find out.

Or use wget to find out.

Or use that whack-a-mole benchmark or SuperSmack or whatever it is.

 Is there anyway to make
 an
 executable run as a service, I am guessing at the terminology that I
 should
 use here, but I feel there would be a much more efficient way of
 performing
 this task.

Any program can be run as a service (Un*x: daemon)

Writing that program to do something useful and, more so, efficient,
is a bit challenging.

Here's a sample talkback service that just spits out whatever you
put in:
http://php.net/sockets

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php