Hello stackoverflow peoples,
A bit of background
My PHP is installed on a windows 7 com using IIS and i implement web.config and the SQL Server (mssql) version is 12.0 .
The site i've built is in a theoretical 3 tiers architecture, meaning i've tested using 2 coms with one com containing the mssql and web tiers and the other containing the app tier.
so when a user connects, it connects like this
[user's com] --request page--> [web tier] --request info--> [app tier] --get info--> [mssql tier]
im using PHP's cUrl function to send requests to the app tier, which looks something like this:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'curl');
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
$result = trim(curl_exec($ch));
plagiarising this question a bit.
sometimes i use an $.ajax call to receive stuff from the web tier, like testimonials or messages.
A typical page contains maybe 10-20 cUrl calls.
The Problem
The problem is the site keeps freezing after 3 or four pages (it's random, but normally in this range) or the page doesnt load everything (its to my understanding that this is due to the curlopt_timeout option? need explaination), and i have to restart the IIS server. I've identified that it's the cUrl function that keeps freezing the com.
I've search for a few months now for a solution, but after about 20 different solutions, i'm at my wits end. i have no idea why cUrl freezes the whole IIS (the whole localhost freezes), and i have no idea why it keeps returning even when i copied the whole site to another com (it got worse).
When i was testing the thing on 2 coms(see above), the site loaded really slow. obviously because of the cUrl as well.
I'm hoping someone can shed some light on what's happening, and a solution, if possible.
Thank you stackoverflow community.
Additional info
If it helps to solve the problem, all cUrl requests go to a single php file on the app tier, dbQuery.php, which reads the input and loads the mssql table page needed, gets or sends whatever info, and returns the mssql result in xml. (im thinking this might cause a bottleneck, since the largest page generated 37 cUrl calls).
Update
this morning (26/3/2012) i tried reducing the number of cUrl calls, and the website performance improved A LOT. but the freezing still occurs though :\