473,657 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pushing the limit of PHP vs ASP.NET

I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local
HDD across the 100 Mbps network, then it poped up window saying "request is
unavailable". PHP worked without problem at all, I verified the saved file
was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer,
doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the download
speed was so slow like back in dial-up ages and the HDD was spinning like
crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>
Nov 18 '05 #1
9 1718
The worse I've done today with ASP is creating a 32 Mb file. I still zip the
file though (down to 6 Mb) before letting the user download it. Works fine
for now but this is still brand new.
For now I've not done this yet in ASP.NET but it should IMO work as well
(the main difference with your approach being I'm writing to a file first).

Could it be a script timeout, an architecture problem (repeatidly response
buffer increases) or a response size limit in the web config ? You could try
to write the content to a file and have a link for donwloading the file to
see how it behaves.

Patrice

"James Macbell" <j.************ *@msn.com> a écrit dans le message de
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local HDD across the 100 Mbps network, then it poped up window saying "request is unavailable". PHP worked without problem at all, I verified the saved file was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer,
doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the download speed was so slow like back in dial-up ages and the HDD was spinning like
crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>

Nov 18 '05 #2
turn off page buffering to match php performance.

-- bruce (sqlwork.com)
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local HDD across the 100 Mbps network, then it poped up window saying "request is unavailable". PHP worked without problem at all, I verified the saved file was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer,
doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the download speed was so slow like back in dial-up ages and the HDD was spinning like
crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>

Nov 18 '05 #3
String contactenation is also an expensive operation in .Net. There's a
special class that may actually boost the performance. Look at the
StringBuilder class in the System.Text namespace. It may boost performance a
tad over string contactentation .

StringBuilder buffer = new StringBuilder() ;
for (int i=1; i<=1024; i++)
buffer.Add("x") ;
// and to get it out
Response.Write( buffer.ToString ());

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local HDD across the 100 Mbps network, then it poped up window saying "request is unavailable". PHP worked without problem at all, I verified the saved file was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer,
doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the download speed was so slow like back in dial-up ages and the HDD was spinning like
crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>

Nov 18 '05 #4
I tried putting this in, didn't make a difference. I even tried to turn off
"buffering" in App Option in IIS, same thing.

<%@ Page Language="C#" Buffer="false" %>

I think it is not a performance issue, it is the limitation of ASP.NET
(perhaps there is some configuration in IIS or Registry that I need to
set?). Have you tried to run the code on your server and successfully saved
the 150 MB file to your local HDD? I couldn't....

PHP worked it out without problem, even under Apache for Win32, I am very
impressed. I like both ASP.NET and PHP, don't get me wrong, I am NOT trying
to prove which lang is more superior than the other, I just try to find a
solution to my problem encountered.

James

"bruce barker" <no***********@ safeco.com> wrote in message
news:OR******** ******@TK2MSFTN GP12.phx.gbl...
turn off page buffering to match php performance.

-- bruce (sqlwork.com)
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code

(C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below). Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache 1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my

local
HDD across the 100 Mbps network, then it poped up window saying "request

is
unavailable". PHP worked without problem at all, I verified the saved

file
was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer, doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the

download
speed was so slow like back in dial-up ages and the HDD was spinning like crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>


Nov 18 '05 #5
I think that's not the problem, because that first Loop only runs for 1024
times. If you insist, try to replace my first loop with yours and run it
the code from your server. See what happens? Are you able to save the 150 MB
file to your local HDD? I couldn't... because IIS stop responding!!! (even
with Page Buffer turn off) But PHP can.

I believe this is a limitation of ASP.NET. Prove me wrong and show me a
code that you can generate 150 MB data and successfully let the client
download it without problem. (NOT allowed to read a file from file system,
to be fair to compare with the PHP code I posted).

I like both ASP.NET and PHP, don't get me wrong, I am NOT trying to prove
which lang is more superior than the other, I just try to find a solution to
my problem encountered.

James
"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message
news:O3******** ******@TK2MSFTN GP11.phx.gbl...
String contactenation is also an expensive operation in .Net. There's a
special class that may actually boost the performance. Look at the
StringBuilder class in the System.Text namespace. It may boost performance a tad over string contactentation .

StringBuilder buffer = new StringBuilder() ;
for (int i=1; i<=1024; i++)
buffer.Add("x") ;
// and to get it out
Response.Write( buffer.ToString ());

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code

(C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below). Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache 1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my

local
HDD across the 100 Mbps network, then it poped up window saying "request

is
unavailable". PHP worked without problem at all, I verified the saved

file
was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer, doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the

download
speed was so slow like back in dial-up ages and the HDD was spinning like crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>


Nov 18 '05 #6

The below works for me; at least the three or four times I tied it (note that IE's cache doesn't like seeing big files like this, but it did manage to get the file and save). In Mozilla it takes about 10ish seconds to after the save dialog box to get the file to disk.

I'm not sure what the point of this is, nor what you are trying to figure out; I suppose I could crank the string allocation up to a couple of gigabytes and eventually asp_net.exe will barf.... are you just trying to see if you can get a 150mb file from memory out to a browser? Are you just interested in comparing speed between PHP and ASP.NET? How fast did PHP feed this back to you?

Scott

<%@ Import Namespace="Syst em.IO" %>
<%@ Page Language="C#" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
<head>
<title>Downlo ad Test</title>
<script language="C#" runat="server">
public void Button1_Click(o bject sender, EventArgs e)
{
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

Response.Clear( );
Response.ClearH eaders();
Response.Charse t = "";
Response.Conten tType = "applicatio n/foobar";
Response.AddHea der("Content-Disposition", "attachment ; filename=speed. dat");
for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
Hello world.
<asp:button id="Button1" runat="server" text="Button" onclick="Button 1_Click"></asp:button>
</form>
</body>
</html>
"James Macbell" <j.************ *@msn.com> wrote in message news:9F******** **********@news 04.bloor.is.net .cable.rogers.c om...
I think that's not the problem, because that first Loop only runs for 1024
times. If you insist, try to replace my first loop with yours and run it
the code from your server. See what happens? Are you able to save the 150 MB
file to your local HDD? I couldn't... because IIS stop responding!!! (even
with Page Buffer turn off) But PHP can.

I believe this is a limitation of ASP.NET. Prove me wrong and show me a
code that you can generate 150 MB data and successfully let the client
download it without problem. (NOT allowed to read a file from file system,
to be fair to compare with the PHP code I posted).

I like both ASP.NET and PHP, don't get me wrong, I am NOT trying to prove
which lang is more superior than the other, I just try to find a solution to
my problem encountered.

James
"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message
news:O3******** ******@TK2MSFTN GP11.phx.gbl...
String contactenation is also an expensive operation in .Net. There's a
special class that may actually boost the performance. Look at the
StringBuilder class in the System.Text namespace. It may boost performance a tad over string contactentation .

StringBuilder buffer = new StringBuilder() ;
for (int i=1; i<=1024; i++)
buffer.Add("x") ;
// and to get it out
Response.Write( buffer.ToString ());

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code

(C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below). Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache 1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my

local
HDD across the 100 Mbps network, then it poped up window saying "request

is
unavailable". PHP worked without problem at all, I verified the saved

file
was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer, doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the

download
speed was so slow like back in dial-up ages and the HDD was spinning like crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>


Nov 18 '05 #7
I think the main problem is using response.write (i don't really remember
why), i wrote something recently that basically performs downloads in 16mb
chunks because of the way iis handles downloads if you use a straight link
(ie it loads it all in memory to send it to the browser). What i used was
returning a set number of bytes from a file until i got to the end of the
file. and used these methods in my loop

Do While iStartbyte < file.Length And
context.Respons e.IsClientConne cted
buffer = MyCustomObject. GetPartialFileB its(iStartbyte,
iNumBytes)
context.Respons e.OutputStream. Write(buffer, 0, iNumBytes)
context.Respons e.Flush()
iStartbyte += iNumBytes
Loop
context.respons e.end

just my 2 cents

jim
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C# vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local HDD across the 100 Mbps network, then it poped up window saying "request is unavailable". PHP worked without problem at all, I verified the saved file was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer,
doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the download speed was so slow like back in dial-up ages and the HDD was spinning like
crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>

Nov 18 '05 #8

I apologize for the confusion. Actually I tested it on another server with the same code I posted as well as yours. They both worked... I think something related to my Windows pagefile and diskspace I think. Sorry about that. Thanks for all your help. You guys rock.
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..

The below works for me; at least the three or four times I tied it (note that IE's cache doesn't like seeing big files like this, but it did manage to get the file and save). In Mozilla it takes about 10ish seconds to after the save dialog box to get the file to disk.

I'm not sure what the point of this is, nor what you are trying to figure out; I suppose I could crank the string allocation up to a couple of gigabytes and eventually asp_net.exe will barf.... are you just trying to see if you can get a 150mb file from memory out to a browser? Are you just interested in comparing speed between PHP and ASP.NET? How fast did PHP feed this back to you?

Scott

<%@ Import Namespace="Syst em.IO" %>
<%@ Page Language="C#" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
<head>
<title>Downlo ad Test</title>
<script language="C#" runat="server">
public void Button1_Click(o bject sender, EventArgs e)
{
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

Response.Clear( );
Response.ClearH eaders();
Response.Charse t = "";
Response.Conten tType = "applicatio n/foobar";
Response.AddHea der("Content-Disposition", "attachment ; filename=speed. dat");
for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
Hello world.
<asp:button id="Button1" runat="server" text="Button" onclick="Button 1_Click"></asp:button>
</form>
</body>
</html>
"James Macbell" <j.************ *@msn.com> wrote in message news:9F******** **********@news 04.bloor.is.net .cable.rogers.c om...
I think that's not the problem, because that first Loop only runs for 1024
times. If you insist, try to replace my first loop with yours and run it
the code from your server. See what happens? Are you able to save the 150 MB
file to your local HDD? I couldn't... because IIS stop responding!!! (even
with Page Buffer turn off) But PHP can.

I believe this is a limitation of ASP.NET. Prove me wrong and show me a
code that you can generate 150 MB data and successfully let the client
download it without problem. (NOT allowed to read a file from file system,
to be fair to compare with the PHP code I posted).

I like both ASP.NET and PHP, don't get me wrong, I am NOT trying to prove
which lang is more superior than the other, I just try to find a solution to
my problem encountered.

James
"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message
news:O3******** ******@TK2MSFTN GP11.phx.gbl...
String contactenation is also an expensive operation in .Net. There's a
special class that may actually boost the performance. Look at the
StringBuilder class in the System.Text namespace. It may boost performance a tad over string contactentation .

StringBuilder buffer = new StringBuilder() ;
for (int i=1; i<=1024; i++)
buffer.Add("x") ;
// and to get it out
Response.Write( buffer.ToString ());

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"James Macbell" <j.************ *@msn.com> wrote in message
news:aI******** *********@twist er01.bloor.is.n et.cable.rogers .com...
I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code

(C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below). Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache 1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my

local
HDD across the 100 Mbps network, then it poped up window saying "request

is
unavailable". PHP worked without problem at all, I verified the saved

file
was 150 MB on my local HDD.

Note:
1. In C# buffer += "x"; is a bit expensive but I have tried StringBuffer, doesn't matter, it only runs for 1024 times anyways.
2. I also tried to set Response.Buffer Output = false in C#, but the

download
speed was so slow like back in dial-up ages and the HDD was spinning like crazy.

- James

ASP.NET code
=============== =============== =============== ==

<%@ Page Language="C#" %>
<%@ Import Namespace="Syst em.IO" %>
<script language="C#" runat="server">
void Page_Load() {
int size= 156105356; // 150 MB data
String buffer = "";

for (int i=1; i<=1024; i++)
buffer += "x";

for (int j=1; j<=size/1024; j++)
Response.Write( buffer);
}
</script>
PHP code
=============== =============== =============== ==

<?php

$size= 156105356; // 150 MB data
$buffer = "";

for ($j=1; $j<=1024; $j++)
$buffer .= "x";

for ($i=1; $i<=($size/1024); $i++)
echo $buffer;

?>


Nov 18 '05 #9
"James Macbell" <j.************ *@msn.com> wrote in message
news:<aI******* **********@twis ter01.bloor.is. net.cable.roger s.com>...

I think I have pushed ASP.NET to the limit, I am not sure if I have done
anything wrong in the code because I am trying to make 2 pieces of code (C#
vs PHP) using the same algorithm. Anyways, here is the my test.

How: Create a HTML page with 2 hyper links to these files (posted below).
Right click, Save target As.
Tested: On my P4 1.6 GHz , 1 GB Ram server, Windows 2000 IIS 5 and Apache
1.3 for win32, 100 Mbps LAN
Sample Size: 150 MB download
Result: IIS stopped responding when I tried to download the link to my local
HDD across the 100 Mbps network, then it poped up window saying "request is
unavailable". PHP worked without problem at all, I verified the saved file
was 150 MB on my local HDD.


It's entirely possible that you tested not ASP.NET vs. PHP, but, rather,
IIS vs. Apache. A good check would be to configue PHP to run under IIS
and try the comparison again. If PHP turns out to work faster again,
you are right and the issue is with the scripting language. If PHP
slows down considerably, it means that IIS is to be blamed.

Cheers,
NC
Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3719
by: Afkamm | last post by:
Hi, :) The preg_replace function... preg_replace(pattern, replacement, subject ) How on earth do you get the limit value to work with arrays? In my code both the pattern and replacement parameters are arrays and I only want a specified number of replacements to occur.
6
2243
by: Graeme Matthew | last post by:
Hi all, I just wanted to tell someone :-) I was previously a perl programmer and have been a visual basic frustrated developer for a number of years, only for the reason that corporates are so obsessed with using proprietary marketing focused computer languages and not using true computer science oriented solutions written by computer science engineers and not a marketing panel. The amount of frustration I have experienced using visual...
4
3304
by: emily_g107 | last post by:
Hi, I need to limit results in the following query type: http://www.somewhere.com/php/sql-a.php3?server=1&db=mydatabase&table=mytable&sql_query=SELECT+Field_1%2CField_2%2CField_3%2Cidno+from+mytable+where+1+and+field_1+like+%22string%22+&sql_order=&pos=1 I found a reference that says I should be able to use LIMIT x, but I don't know where/exactly how to add that to the string. Once I know what it's supposed to look like, and can...
0
5775
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ? SELECT ... ; ----> returns 100,000 rows
3
1372
by: John Wood | last post by:
Maybe it's just my imagination, but I don't really see Microsoft pushing the ..Net runtime out there... you'd think they'd be including it in every download and new product they ship. How are people going to have Internet downloadables written using .Net if the user has to also find, download and install the .Net framework also??
7
5110
by: DW | last post by:
Hi, Here is my question. I want to push security prices to the desktop from the server. Whenever there is a new price in the database, the server notifies the client. How can this be done in the following situations using MS .NET Winforms on the desktop: 1. Using .NET Web Services on server 2. Using Java Web Services on server
1
1567
by: ryan | last post by:
I have a question about pushing realtime stock quotes to clients through the Internet. Is this even possible in .NET environment without creating serious network bottleneck problems? The clients may go in and out of the server zone. I am leaning towards client-initiated posts to a web service (every x milliseconds) -about 500 clients.
4
10767
by: Bill | last post by:
Hi, I would be grateful if someone could clarify my rather confused ideas of the 10 connection limit on XP/2000 when its being used as a server. (I realise that XP is really a client op sys with limited server capability, I am also aware you can kludge the number to 40, but assume I do not want to do that). As I understand it XP Pro will support 10 simultaneous inbound (SYN) connections (5 for XP Home). My confusion arises as to what...
3
4115
by: BobRoyAce | last post by:
I am using Visual Studio 2008 w/ VB.NET. For the database, I am using SQL Server 2005, which is running on a dedicated server box. I am creating a WinForms application for a client. It is run on any of several employees' desktop PCs. Now, they want to be able to "push" some of the data from the SQL Server database up to a database on a website (also SQL Server 2005).
0
8421
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8325
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.