Anyone else want to compare benchmarks with ab. This is what I got testing a 2meg file.

 
* Concurrency Level: 200
* Complete requests: 1000
* Document Length: 2248841 bytes
* Requests per second:
           - direct request: 4.72s
           - fpassthru: 5.03s (110/200 failed requests)
           - fread: 3.93s (191/200 failed requests LOL)
           - readfile: 5.05s (114/200 failed requests)

This is what happened when I lowered the concurrency level to 100 so all requests would complete.
* Concurrency Level: 100
* Complete requests: 1000
* Document Length: 2248841 bytes
* Requests per second:
           - direct request: 4.72s
           - fpassthru: 5.06s
           - fread: 5.07s
           - readfile: 5.05s

As you can see it looks like fpassthru looks like it was a winner by a hair. They all used approximately the same amount of memory (+- 6 megs), I kept an eye on it with a top process.

Please monitor your memory while benchmarking and make sure and restart apache after every test, I learned that the hard way.

    I've had more luck and stability using [man]file_get_contents[/man] that using readfile.

      drew010 wrote:

      I've had more luck and stability using [man]file_get_contents[/man] that using readfile.

      agree
      [man]file_get_contents[/man]
      is a very good php function
      - easy to use - no fopen fp fread fclose - just plain file get contents
      - even works with remote files: file_get_contents( URL to file ) !!!!

      do not know about speed
      think not is very much different from using any alternative - a few % ...

      but surely this function is easy to use!
      a blessing for ordinary levels php users and beginners
      and for

      halojoy

      ..

        echo file_get_contents("file");

        outputs it, same effect as readfile.

          its using that much memory because the guy probably stored the whole 1 megabyte file into a variable. if you use echo the contents are not stored in a variable, it is just read and sent to the output buffer.

            Anyone else want to compare benchmarks with ab. This is what I got testing a 2meg file.

             
            * Requests per second:
                       - direct request: 4.72s
                       - fpassthru: 5.04s (110/200 failed requests)
                       - fread: 3.93s (90/200 failed requests and ate entire systems memory)
                       - readfile: 5.05s (114/200 failed requests)
            
            

            Please monitor your memory while benchmarking and make sure and restart apache after every test, I learned that the hard way.

              updated the topmost thread in case anyone is interested.

                Write a Reply...