Solved

PHP - AJAX - why is file access sequential - No Sessions

Posted on 2012-03-28
4
391 Views
Last Modified: 2012-06-27
I have a php file that acts as a gateway to an application server. The php file acts as a connector, it collects values from the request and opens a socket to send a msg to the application server, and then echoes back the returned response - generally some HTML.

The process works correctly, however an individual user can only send requests in serial manner, ie one request to the php file must complete before the next queued request is executed. However multiple users can access the same file, and two simultaneous requests from two different browsers from the same PC will also work.

We are not using any php session management as the application server handles all of that.

I am confused as to why I cannot execute multiple calls to the same file from a single connection/'session'.

As a footnote, the PHP file used with IIS 7.5 does not exhibit this behaviour an individual connection can access the php file in a con-current manner.

Here are some settings from php.ini

session.save_handler = files
session.auto_start = 0

The environment is Ubuntu Server 10.04.4
PHP Version 5.3.2-1ubuntu4.14
Apache/2.2.14 (Ubuntu) Server built: Feb 14 2012 16:42:25
0
Comment
Question by:kyleitvss
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37776124
It could be due to PHP socket blocking, which is ON by default in PHP -- I don't know if in IIS your default is off.
Bu it's probably something in your Apache configuration.
Check the "accept Serialization - multiple sockets" section in this page:

http://httpd.apache.org/docs/2.2/misc/perf-tuning.html

PS: Sessions have nothing to do with it
0
 

Accepted Solution

by:
kyleitvss earned 0 total points
ID: 37779638
I looked thru' that section ( "accept Serialization - multiple sockets") - and it was very interesting however it was a way over my head. However, I did some testing and found that if the URL is made to be unique then simultaneous requests will get processed.

http://<servername>/path/connector.php/test_response?site_id=mysite&uniqueid=11111

http://<servername>/path/connector.php/test_response?site_id=mysite&uniqueid=22222

So its not sessions as you noted - its how Apache handles discrete requests from a browser.
0
 
LVL 7

Expert Comment

by:designatedinitializer
ID: 37779703
that's got be something you can tweak in the conf, though you will surely go about it that way you devised.
0
 

Author Closing Comment

by:kyleitvss
ID: 37815442
Further testing proved the issue was a related to the uniqueness of the URL
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question