4

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 :\

Community
  • 1
  • 1
we.mamat
  • 687
  • 11
  • 21
  • Are there any messages in the Windows Log? – René Höhle Mar 23 '12 at 09:02
  • if u mean the httperr.log, no, just a bunch of Timer_ConnectionIdle – we.mamat Mar 23 '12 at 09:07
  • No i meant the system log unter "My Computer" -> right click -> Manage and there the syslogs. If the server hang then there are no messages in the httperr.log – René Höhle Mar 23 '12 at 09:12
  • http://windows.microsoft.com/en-US/windows-vista/Open-Event-Viewer There are the system protokolls. You should look, if you can find something that looks like your problem. – René Höhle Mar 23 '12 at 09:41
  • i've tried to take a look, but i have no idea what i'm looking for. There aren't any critical errors, and the errors thats compiled are mostly for startup or SSL certificate errors, and i dont use ssl – we.mamat Mar 23 '12 at 09:50
  • i did find however a quite a lot of "starting MSSQL database" infos, sometimes once every 2-3 seconds – we.mamat Mar 23 '12 at 09:53

2 Answers2

0

I've recently put the website on my client's webservers, ant the freezing seemed to go away. any idea why though?

Since this changes things, should i change this question to a localhost cUrl problem? I still have no idea why cUrl froze my localhost, or why it disappeared when i put it in an actual 3 tier environment.

Either way, question solved...without an answer :(

we.mamat
  • 687
  • 11
  • 21
0

It might be due to that the url you are trying to read using curl may take more time to load. So try to load the same url in your browser and check the it is taking to load.

Stranger
  • 10,332
  • 18
  • 78
  • 115