Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[appserver-io/appserver] Multithreading in Windows #653

Closed
ndamofli opened this issue Mar 6, 2015 · 18 comments
Closed

[appserver-io/appserver] Multithreading in Windows #653

ndamofli opened this issue Mar 6, 2015 · 18 comments

Comments

@ndamofli
Copy link

ndamofli commented Mar 6, 2015

Hi there, I installed the windows version of appserver and i have a problem with multithreading.
I have a simple php script that runs an exec command and returns the output.
I am trying to run this script multiple times concurrently but my requests are processed one by one (serial).
I am using another (apache) server to invoke the requests to appserver via multi-curl.

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

Hi, could you paste your script here? it's will help a lot to understand whats intended to do. Cheers.

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

I am using phantomjs.exe (a headless browser) to create screenshots of websites.
My intention is to make multiple parallel queries to appserver's webserver like the following:

http://localhost:9080/phantom/phantom_bp.php?url=$url

The script phantom_bp.php contains:
$command = "phantomjs.exe phantom.js $url";
function exec_alt($cmd, $counter){
$return = exec($cmd, $output);
if (!$output) {
$return = "NOPHANTOM";
}
return $return;
}

I use multi-curl to invoke multiple requests from another script on another webserver.
The script works, but appserver processes the requests one by one.

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

Ok thanks for sharing you script. Is that script called from browser or another Webserver using another script which uses multicurl?... sorry for that questions... but i still can not follow you... could you visualize your request chain like.

  1. Browser requests http://...
  2. Triggered script via apache and mod-php uses multi_curl and requests http://...
  3. Triggered script via appservers webserver requests phantomjs.exe

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

This script is called from chrome browser from another webserver (apache @ localhost:80) and it uses multicurl.
So the chain is as follows:

  1. Browser (chrome) requests multi_update.php from apache server @ port 80
  2. apache php script makes multiple requests to appserver (@ port 9080) via multi curl
  3. php script in appserver requests phantomjs.exe
    Thank you so much for your time and effort

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

Ok what if you call the appserver script (@PORT 9080) directly from the browser. Does that work concurrently?

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

No it doesn't. I tried opening multiple chrome windows and they don't work concurrently

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

I guess exec under windows causes the process to block while the execution is in progress. You could try to replace the exec with error_log('simulate phantomjs to be executed');sleep(1); to see if it is still not concurrently.

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

Unfortunately i still have serial output. I opened 5 windows with sleep time 5secs and the request were processed one after another (not parallel)

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

Ok i'll check that on my windowz machine...

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

thank you zelgerj

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

hm sorry but i can not reproduce your problem. Parallel requests on a script with sleep(5) are processed all concurrently... some special on your configuration or windows system itself?!

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

well i didn't make any changes to the default configuration of appserver, and i'm only using a simple wamp server (for apache, php mysql) on a windows 7 64bit hexacore i7. bummer.

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

could u please send me a link of your installation.? maybe i have a wrong version of appserver (i downloaded it today from appserver's homepage)

@zelgerj
Copy link
Member

zelgerj commented Mar 6, 2015

The link should be ok... I'll create a test for that scenario, that checks if it is non-concurrent. I'll get back on you if it is ready...

@ndamofli
Copy link
Author

ndamofli commented Mar 6, 2015

Thank you very much Zelgerj.. Just to let you know, i installed appserver to another machine (win7 32 bit this time) and i had the same problem (tried the multiple windows & sleep script).

@wagnert wagnert added this to the Release 1.0.3 "Iron Horse" milestone Mar 17, 2015
@wagnert wagnert changed the title multithreading in windows [appserver-io/appserver] Multithreading in Windows Mar 17, 2015
@zelgerj
Copy link
Member

zelgerj commented Mar 26, 2015

@ndamofli: Finally i'am not able to reproduce the problem. Could you setup a virtual machine and gimme access to it, so i can reproduce and debug the problem?

@wick-ed
Copy link
Member

wick-ed commented May 12, 2015

Hi @ndamofli ,

can you give us an update on this issue? We were not able to reproduce it here and would like to close it if the problem does not exist anymore.

@wick-ed
Copy link
Member

wick-ed commented May 18, 2015

Closed as not reproducable

@wick-ed wick-ed closed this as completed May 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants