Re: GD to database directly
| From: | Adam Zey | Date: | Tue, 11 Jul 2006 20:59:50 +0000 |
| Subject: | Re: GD to database directly | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239324@lists.php.net to get a copy of this message | ||
Eric Butera wrote:
On 7/11/06, Kevin Waterson <kevin@oceania.net> wrote:The time taken per request, though (and that's about all we can get with a concurrency as low as 5) doesn't tell us much. We also don't know exactly what the PHP code is doing, how it does it, how your database is organized/indexed/accessed, if you have any PHP accelerators installed (Normally the PHP script would be reconverted to bytecode every execution), etc. Additionally, your test isn't really MySQL versus filesystem, it's PHP+MySQL versus filesystem. Perhaps a more useful comparison would be PHP+Filesystem versus PHP+MySQL. As in, the same PHP script for both benchmarks, except one copy uses file_get_contents and echo (Closer match than readfile, since MySQL would require loading the file into memory) and the other uses MySQL. This would be a closer match that would tell us how much latency is induced by the actual database itself rather than PHP and loading stuff into memory. Regards, Adam.How much of a performance hit? Kevin -- "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpHere's to being bored on lunch. :) Now to add my two cents to the convo: I don't see a problem with storing images in the DB IF they aren't going to be continually accessed that way. For example say you have a script that lets a user upload an image and creates a small, medium, and large view out of it. Stick the original in the Db and then make your 3 sizes on the fly and cache the output so they are not continually created. This way you could down the road re-do all the sizes if you go through a site redesign or the client chooses they want them 450 instead of 400. =) Via MySQL 4.1 & PHP 5.1.4: erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/viewimage_db.php This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Finished 500 requestsServer Software: Apache/1.3.33 Server Hostname: localhost Server Port: 80Document Path: /fs_vs_db/viewimage_db.php Document Length: 25256 bytesConcurrency Level: 5Time taken for tests: 4.323 secondsComplete requests: 500 Failed requests: 0 Broken pipe errors: 0 Total transferred: 12727000 bytes HTML transferred: 12628000 bytes Requests per second: 115.66 [#/sec] (mean) Time per request: 43.23 [ms] (mean) Time per request: 8.65 [ms] (mean, across all concurrent requests) Transfer rate: 2944.02 [Kbytes/sec] receivedConnnection Times (ms)min mean[+/-sd] median max Connect: 0 0 0.4 0 10 Processing: 14 42 12.6 38 147 Waiting: 14 42 12.6 38 147 Total: 14 42 12.6 38 147Percentage of the requests served within a certain time (ms)50% 38 66% 40 75% 44 80% 46 90% 56 95% 67 98% 78 99% 97 100% 147 (last request)Raw Image: erics:~ eric$ ab -n500 -c5 http://localhost/fs_vs_db/cloud.jpg This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3 Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Finished 500 requestsServer Software: Apache/1.3.33 Server Hostname: localhost Server Port: 80Document Path: /fs_vs_db/cloud.jpg Document Length: 25256 bytesConcurrency Level: 5Time taken for tests: 0.624 secondsComplete requests: 500 Failed requests: 0 Broken pipe errors: 0 Total transferred: 12775000 bytes HTML transferred: 12628000 bytes Requests per second: 801.28 [#/sec] (mean) Time per request: 6.24 [ms] (mean) Time per request: 1.25 [ms] (mean, across all concurrent requests) Transfer rate: 20472.76 [Kbytes/sec] receivedConnnection Times (ms)min mean[+/-sd] median max Connect: 0 1 0.7 1 5 Processing: 3 5 6.6 4 131 Waiting: 1 4 6.7 3 130 Total: 3 6 6.5 5 131Percentage of the requests served within a certain time (ms)50% 5 66% 5 75% 5 80% 6 90% 7 95% 10 98% 11 99% 19 100% 131 (last request)