Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-03-2008, 04:03 PM
Junior Member
 
Join Date: Mar 2008
Posts: 2
Unhappy Multi-user Database Locking Process Forking?

I have an application written in PHP, and i'm trying to not to convert it to Java (for its locking functionality), and possibly do it somehow with PHP.

maybe PHP and Java.

My needs are that if 20 users are accessing the system, instead of having 20 DB connections, i can have 5 or whatever the case serving the needs of 20.

A constantly running request handler? This is also known to some as process forking, to fork a process into child processes.

In other words, is it possible to run a PHP background process that can handle requests?

Through what i know of PHP, this is not possible, but i'm not 100% sure.

any ideas on how i can achive this, or with any other technology? Java and PHP get along good through anybody experience?

thanks guys,


DM
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-03-2008, 05:46 PM
Junior Member
 
Join Date: Jan 2008
Posts: 12
Default

FastCGI ?
Are you trying to achieve some performance gains ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-03-2008, 07:21 PM
Junior Member
 
Join Date: Mar 2008
Posts: 2
Wink

more like locking.

For example I have PHP FTP set and getting a file, and I don't want another user to call it, and hence over writing the first user's file.

wanted to wait until the file is recieved and back (10 seconds), that file is parsed and the data is taken out.

If another user executes the same request action, the file will be over written on the FTP server. (I'm limited in that way, the program on the remote server can take and generate one file at a time, i can't create multiples).

So while i'm waiting that 10 seconds, i want to tell all other requests a busy signal and try again later.

The way i'm planning to do this is to have a database row that sets a boolean value

when a request is made, it is set to busy, and all incoming requests will be denied, when that user's file is received and parsed, the record is changed back to ready and will process the next request.

How my vendor works is that, i ftp a file with a specificname, in a few seconds, their program reads my "request" file and processes the "response" file. I basically have a loop that waits 5 seconds and checks to see if this response file exists yet. If it does, i grab it, and parse the data in it. Then its ready for the next transaction.

I hope that all makes sense, i know its a lot of reading.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-04-2008, 04:09 PM
xentek's Avatar
Senior Member
 
Join Date: Feb 2008
Posts: 111
Default

Take a look at flock()... a PHP function. PHP: flock - Manual
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:54 AM.