Zane Posted April 6, 2009 Share Posted April 6, 2009 Honestly, what it the difference in the two? Sure, one is faster than the other, but what is the true difference. What can one possibly benefit from using FastCGI over ISAPI or vice versa. I can't google a single decent reading on this question. I've used ISAPI ever since I started messing with PHP. Yet, I still have the grass is always greener syndrome. What am I missing? Without any jargon. I'm sure other people are wanting to know this too. I found this page at the best http://forums.iis.net/t/1146597.aspx Does anyone have any insight on the FastCGI procedure. Hell, I can install PHP, MySQL, and Apache streamlined...but I always do it with ISAPI. Either way, I'm just following a conditioned routine. If I get an Apache error...I pretty much just google it and find my answer. I don't get paid to develop servers. Also, I'm asking this question from the perspective of someone who hasn't compiled PHP before. I see people talk about it all the time. Compile it with safe-mode, compile it without get-magic-quotes, etc, etc. I think I'm going a little off topic now. But honestly, what makes one module better than the other. Why is there TWO? And please don't tell me that there isn't a difference and that it's pure preference....they have two for a reason and the reason is soo hidden under jargon that I give up on understanding. Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/ Share on other sites More sharing options...
corbin Posted April 6, 2009 Share Posted April 6, 2009 ISAPI under Apache? Apache modules aren't the same as ISAPI ones are they? So aren't there 3 ways? Also, are you talking about under IIS or Apache? I've always understood ISAPI to be on IIS. I've always thought that Apache modules followed an entirely different specification. Have I been wrong? I've no insight on your question. Just curious ;p. Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-802911 Share on other sites More sharing options...
Zane Posted April 6, 2009 Author Share Posted April 6, 2009 I've no insight on your question. Just curious ;p. It's not so much..that I'm looking for an answer. I'm looking for clarification. Without having to run 100s of stability tests and memory benchmarks and what not, (Actually, where are these statistics if any.) I would like to be able to briefly paraphrase to someone in "dummy" terms what each one actual is. Instead I have to regurgitate something I've googled even though I KNOW I have experience with it...I don't know the differences that are there....rather than installation procedure. A Google Definition ISAPI Definitions of ISAPI on the Web: * The Internet Server Application Programming Interface (ISAPI) is an N-tier API of Internet Information Services (IIS), Microsoft's collection of ... en.wikipedia.org/wiki/ISAPI * Internet Information Server API, API supported by the MS's Internet Information Server (IIS). www.softwareag.com/xml/about/glossary.htm * A high-performance interface used to interact with Web-based databases. www.thecomputerfolks.com/i.htm FastCGI FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once. CGI The Common Gateway Interface (CGI) is a standard protocol for interfacing external application software with an information server, commonly a web server. ISAPI under Apache? Apache modules aren't the same as ISAPI ones are they? So aren't there 3 ways? Also, are you talking about under IIS or Apache? I've always understood ISAPI to be on IIS. I've always thought that Apache modules followed an entirely different specification. Have I been wrong? I guess you are right...I just check my phpinfo() and my current Gateway Interface is CGI/1.1 I can only assume that means I'm using FastCGI. but on the other hand -> http://httpd.apache.org/docs/1.3/mod/mod_isapi.html I've no insight on your question. Just curious ;p. Yeah sometimes I ask sometimes stupid questions and worry about things I probably shouldn't care about. But often times I'm having to explain something I'm used to when someone confronts me with, "Why." So why ISAPI rather than FastCGI? In which I'd answer....just because. That's a worthless answer. Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-802985 Share on other sites More sharing options...
corbin Posted April 6, 2009 Share Posted April 6, 2009 Oddly enough, I installed IIS7 and PHP a second ago through the Microsoft Web Tools installer thing or what ever it's called, and it installed PHP in FastCGI mode. Weird, since MS came up with ISAPI. Wait... Are you talking about Apache? Why would you go with ISAPI? I would probably pick Apache module, FastCGI, ISAPI, CGI, but like you, I have no reasons. (Well, I have reasons why CGI sucks.) Why use a module (mod_isapi) so that you can load ISAPI modules when there's an Apache-native PHP module? (Or am I wrong in assuming that apache2php.dll or what it's called is an Apache module and not ISAPI?) Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-803005 Share on other sites More sharing options...
Zane Posted April 7, 2009 Author Share Posted April 7, 2009 and it installed PHP in FastCGI mode. Yeah, and what exactly does that mean for you? How is it compared to ISAPI? What can you now (not) do that you are in FastCGI? I probably sound like I'm going crazy here, but I simply don't understand it all. It's just like the "unlimited bandwidth" concept to me. We now offer our PHP Server with FastCGI!!! Woo....!!! Like the word "Fast" is just good enough of an explanation for the average user. What is so Fast about it. And as far as I know, a CGI script is the same as a PHP script. Just two different server-side languages. I'm sure if I were a lot more well versed in Linux I could understand this all sooo much better, but I'm not. I'm a Windows junkie, stuck in the checkbox utopia of "ISAPI or FastCGI" I'm not just asking this for myself, I'm trying to gather up enough knowledge on this subject that everyone can understand. If you are a true web developer then you know ALL the tools and when to use them. I have two tools whose reasons I don't even know about. I think I've confused myself more by writing about all this than I was before the thought came to mind. EDIT: I believe my only answer is going to come from me installing a barebones Apache server...and doing the building block process Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-803108 Share on other sites More sharing options...
corbin Posted April 7, 2009 Share Posted April 7, 2009 The fatal flaw in CGI is that it is entirely separate requests. Yes, yes, that sounds like "HTTP is a stateless protocol," but that's not how I mean it. Let's pretend I have a program called Corbin.exe. Now, let's pretend it follows the CGI specifications and I have Apache serving it. On each and every request, Apache will do the following: 1. Process the request like normal. (Parse the headers, so on so forth, figure out if it's a GET/POST/CONNECT what ever request and act accordingly.) 2. If a CGI app is set up to handle the request (a GET to /Corbin.exe for example), then pass off the content to the CGI app. (Brief overview of the CGI specification... POST data is passed to stdin, the GET query string is in an environmental variable. All other server variables are in environmental variables. In other words, the CGI app is spawned as an application under Apache. If you've ever used CreateProcess when programming in C/C++/VB or somethign like that on Windows, it's the same concept, just it's probably not done that way.) 3. The CGI app does it's thing and returns the content. 4. Apache frees all handles to the exes, frees all other memory (although the handles would get all of it I'm sure). 5. Apache flushes the content to the socket and the request ends (unless it's keep-alive, but just go with me here). Now, with an Apache module (I don't know why you would use ISAPI under Apache), the same thing happens except the module is loaded when Apache first runs (or when a new process/thread is spawned). That way, there isn't the overhead of constantly spawning new processes and what not. There are new challenges created by that though, although you would never know it from the PHP side. The module essentially sits there waiting for a signal, so all of the code done in the module essentially happens in a loop. Think of it this way: while(need_do_something()) { } Where need_do_something() is a blocking function that will return true if something needs to be done. (It's not that simple, but hey... what ever ;p.) Now, what in the world is FastCGI compared to CGI and why is it "Fast"? FastCGI doesn't spawn a new process each request. It's a daemon that Apache communicates with over sockets (I think over sockets... Might be process pipes). It's kind of like how PHP connects to a MySQL server. Instead of starting the server every time you need some information, getting the information and then shutting back down, the MySQL daemon runs separately, waiting for requests. And yes, compared to CGI, FastCGI is very, very fast. If I can figure out what I did to keep making IIS crash I'll do some benchmarks. Now I'm going to go look into FastCGI for Apache lol. I usually use Apache by the way.... In case you couldn't figure that out by my inability to work IIS haha. Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-803144 Share on other sites More sharing options...
corbin Posted April 8, 2009 Share Posted April 8, 2009 Hrmmm interesting... Some tests.... There are flaws in the tests of course. Just showing the difference in CGI/FastCGI.... First test File contents: <?php phpinfo(); IIS with CGI ab -n 1000 -c 10 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 59266 bytes Concurrency Level: 10 Time taken for tests: 109.012 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 59466000 bytes HTML transferred: 59266000 bytes Requests per second: 9.17 [#/sec] (mean) Time per request: 1090.120 [ms] (mean) Time per request: 109.012 [ms] (mean, across all concurrent requests) Transfer rate: 532.71 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.0 0 25 Processing: 750 1085 675.1 978 8300 Waiting: 749 1084 675.1 978 8299 Total: 750 1086 675.2 978 8301 Percentage of the requests served within a certain time (ms) 50% 978 66% 1015 75% 1042 80% 1069 90% 1175 95% 1220 98% 2996 99% 5832 100% 8301 (longest request) C:\Users\Corbin>ab -n 1000 -c 50 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 59266 bytes Concurrency Level: 50 Time taken for tests: 102.494 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 59466000 bytes HTML transferred: 59266000 bytes Requests per second: 9.76 [#/sec] (mean) Time per request: 5124.700 [ms] (mean) Time per request: 102.494 [ms] (mean, across all concurrent requests) Transfer rate: 566.59 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.9 0 22 Processing: 261 5005 1181.3 4881 10056 Waiting: 260 5005 1181.3 4881 10055 Total: 261 5006 1181.3 4882 10057 Percentage of the requests served within a certain time (ms) 50% 4882 66% 4916 75% 4944 80% 4959 90% 5062 95% 9007 98% 9300 99% 9356 100% 10057 (longest request) C:\Users\Corbin>ab -n 1000 -c 100 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 59266 bytes Concurrency Level: 100 Time taken for tests: 106.436 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 59466000 bytes HTML transferred: 59266000 bytes Requests per second: 9.40 [#/sec] (mean) Time per request: 10643.600 [ms] (mean) Time per request: 106.436 [ms] (mean, across all concurrent requests) Transfer rate: 545.61 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 1.4 0 30 Processing: 318 9804 1994.5 9868 17108 Waiting: 316 9803 1994.5 9867 17107 Total: 319 9805 1994.6 9868 17108 Percentage of the requests served within a certain time (ms) 50% 9868 66% 10187 75% 10423 80% 10817 90% 11211 95% 12333 98% 12552 99% 12640 100% 17108 (longest request) IIS - FastCGI C:\Users\Corbin>ab -n 1000 -c 10 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 56797 bytes Concurrency Level: 10 Time taken for tests: 5.174 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 56997000 bytes HTML transferred: 56797000 bytes Requests per second: 193.27 [#/sec] (mean) Time per request: 51.740 [ms] (mean) Time per request: 5.174 [ms] (mean, across all concurrent requests) Transfer rate: 10757.85 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.7 0 9 Processing: 32 51 45.5 45 515 Waiting: 31 50 45.6 44 515 Total: 33 51 45.5 45 516 Percentage of the requests served within a certain time (ms) 50% 45 66% 47 75% 50 80% 51 90% 56 95% 61 98% 74 99% 466 100% 516 (longest request) C:\Users\Corbin>ab -n 1000 -c 50 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 56797 bytes Concurrency Level: 50 Time taken for tests: 4.721 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 56997000 bytes HTML transferred: 56797000 bytes Requests per second: 211.82 [#/sec] (mean) Time per request: 236.050 [ms] (mean) Time per request: 4.721 [ms] (mean, across all concurrent requests) Transfer rate: 11790.11 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.7 0 10 Processing: 37 229 28.2 233 269 Waiting: 34 228 28.3 232 268 Total: 37 229 28.2 234 270 Percentage of the requests served within a certain time (ms) 50% 234 66% 238 75% 240 80% 242 90% 248 95% 252 98% 256 99% 260 100% 270 (longest request) C:\Users\Corbin>ab -n 1000 -c 100 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 56797 bytes Concurrency Level: 100 Time taken for tests: 4.744 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 56997000 bytes HTML transferred: 56797000 bytes Requests per second: 210.79 [#/sec] (mean) Time per request: 474.400 [ms] (mean) Time per request: 4.744 [ms] (mean, across all concurrent requests) Transfer rate: 11732.95 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 9 Processing: 67 450 74.3 470 513 Waiting: 63 449 74.4 470 512 Total: 67 451 74.4 471 514 Percentage of the requests served within a certain time (ms) 50% 471 66% 478 75% 481 80% 483 90% 489 95% 492 98% 497 99% 502 100% 514 (longest request) C:\Users\Corbin>ab -n 10000 -c 100 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software: Microsoft-IIS/7.0 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 56797 bytes Concurrency Level: 100 Time taken for tests: 47.051 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 569970000 bytes HTML transferred: 567970000 bytes Requests per second: 212.54 [#/sec] (mean) Time per request: 470.510 [ms] (mean) Time per request: 4.705 [ms] (mean, across all concurrent requests) Transfer rate: 11829.96 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.7 0 10 Processing: 69 467 56.4 468 5511 Waiting: 65 466 25.2 467 520 Total: 70 468 56.4 469 5511 Percentage of the requests served within a certain time (ms) 50% 469 66% 472 75% 474 80% 476 90% 479 95% 483 98% 489 99% 493 100% 5511 (longest request) Apache with PHP as a module C:\Users\Corbin>ab -n 1000 -c 10 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Apache/2.2.10 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 52657 bytes Concurrency Level: 10 Time taken for tests: 5.788 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 52892000 bytes HTML transferred: 52657000 bytes Requests per second: 172.77 [#/sec] (mean) Time per request: 57.880 [ms] (mean) Time per request: 5.788 [ms] (mean, across all concurrent requests) Transfer rate: 8924.04 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 1.7 1 17 Processing: 12 56 15.4 55 153 Waiting: 1 39 14.8 42 121 Total: 12 57 15.2 56 153 Percentage of the requests served within a certain time (ms) 50% 56 66% 61 75% 65 80% 67 90% 76 95% 84 98% 93 99% 101 100% 153 (longest request) C:\Users\Corbin>ab -n 1000 -c 50 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Apache/2.2.10 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 52657 bytes Concurrency Level: 50 Time taken for tests: 5.665 seconds Complete requests: 1000 Failed requests: 1 (Connect: 0, Receive: 0, Length: 1, Exceptions: 0) Write errors: 0 Total transferred: 52891963 bytes HTML transferred: 52656963 bytes Requests per second: 176.52 [#/sec] (mean) Time per request: 283.250 [ms] (mean) Time per request: 5.665 [ms] (mean, across all concurrent requests) Transfer rate: 9117.79 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 11 Processing: 44 275 33.8 281 361 Waiting: 36 266 35.9 273 330 Total: 45 276 33.8 281 361 Percentage of the requests served within a certain time (ms) 50% 281 66% 286 75% 289 80% 291 90% 298 95% 306 98% 320 99% 336 100% 361 (longest request) C:\Users\Corbin>ab -n 1000 -c 100 http://localhost/info562.php This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests Server Software: Apache/2.2.10 Server Hostname: localhost Server Port: 80 Document Path: /info562.php Document Length: 52657 bytes Concurrency Level: 100 Time taken for tests: 5.800 seconds Complete requests: 1000 Failed requests: 2 (Connect: 0, Receive: 0, Length: 2, Exceptions: 0) Write errors: 0 Total transferred: 52892050 bytes HTML transferred: 52657050 bytes Requests per second: 172.41 [#/sec] (mean) Time per request: 580.000 [ms] (mean) Time per request: 5.800 [ms] (mean, across all concurrent requests) Transfer rate: 8905.58 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.9 0 18 Processing: 186 546 89.2 573 787 Waiting: 101 533 101.0 565 671 Total: 186 547 89.2 573 788 Percentage of the requests served within a certain time (ms) 50% 573 66% 578 75% 580 80% 582 90% 590 95% 601 98% 623 99% 662 100% 788 (longest request) (This was mainly a comparison between CGI/FastCGI. I just threw in the Apache module one for kicks and giggles. My Apache installation is far from speed optimized.) Quote Link to comment https://forums.phpfreaks.com/topic/152818-fastcgi-vs-isapi/#findComment-804197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.