[Gambas-user] Future of webform component
Christof Thalhofer
chrisml at deganius.de
Sat Jan 4 19:08:35 CET 2020
Am 01.01.20 um 14:41 schrieb PICCORO McKAY Lenz:
> If all the data is transferred with pipelines, this implementation is
> not scalable as such, I do not understand as for example, php that is
> interpreted is so fast and popular instead of gambas, which is what
> makes php faster, we know that php It does not run on threads.
I am on the way to rewrite a website originally written in PHP to Gambas.
Now I am as far that I can compare the performance of both languages
quite a bit by running Apache Benchmark against the old code and the
new, written in Gambas (which nearly does the same).
The code loads data from a Postgresql database (15 queries), loads and
fills about 30 templates, also creates HTML from texts written in
Markdown and sticks that all together. Also it loads the stats of 12
images to create HTML Image Tags with width and height.
The sizes of both webpages differs a bit as I am not ready at the moment.
At a glance I can report that Gambas (CGI) is not very far from PHP
(mod_php) concerning performance. At best PHP is 1.5 or at maximum two
times as fast as Gambas.
This is PHP (PHP 7.0.33-14+0~20191218.25+debian9~1.gbpae1889) running on
Apache as mod_php:
> christof at tof-x230 ~/programming/webseiten/deganius.de ±master » ab -n 100 -c 10 http://deglocal.com/
> This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking deglocal.com (be patient).....done
>
>
> Server Software: Apache/2.4.25
> Server Hostname: deglocal.com
> Server Port: 80
>
> Document Path: /
> Document Length: 51803 bytes
>
> Concurrency Level: 10
> Time taken for tests: 3.556 seconds
> Complete requests: 100
> Failed requests: 0
> Total transferred: 5206900 bytes
> HTML transferred: 5180300 bytes
> Requests per second: 28.12 [#/sec] (mean)
> Time per request: 355.574 [ms] (mean)
> Time per request: 35.557 [ms] (mean, across all concurrent requests)
> Transfer rate: 1430.04 [Kbytes/sec] received
>
> Connection Times (ms)
> min mean[+/-sd] median max
> Connect: 0 0 0.1 0 0
> Processing: 138 349 54.6 358 474
> Waiting: 135 336 51.9 347 463
> Total: 138 349 54.6 358 474
>
> Percentage of the requests served within a certain time (ms)
> 50% 358
> 66% 376
> 75% 387
> 80% 392
> 90% 413
> 95% 421
> 98% 449
> 99% 474
> 100% 474 (longest request)
Interestingly this result is achieved after some runs of PHP, the first
one causes this:
> Percentage of the requests served within a certain time (ms)
> 50% 375
> 66% 406
> 75% 428
> 80% 451
> 90% 524
> 95% 605
> 98% 806
> 99% 962
> 100% 962 (longest request)
And here is Gambas 3.9 on the same machine:
> christof at tof-x230 ~/programming/webseiten/deganius.de ±develop⚡ » ab -n 100 -c 10 http://deglocal.com/
> This is ApacheBench, Version 2.3 <$Revision: 1807734 $>
> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
> Licensed to The Apache Software Foundation, http://www.apache.org/
>
> Benchmarking deglocal.com (be patient).....done
>
>
> Server Software: Apache/2.4.25
> Server Hostname: deglocal.com
> Server Port: 80
>
> Document Path: /
> Document Length: 47307 bytes
>
> Concurrency Level: 10
> Time taken for tests: 5.114 seconds
> Complete requests: 100
> Failed requests: 0
> Total transferred: 4755100 bytes
> HTML transferred: 4730700 bytes
> Requests per second: 19.55 [#/sec] (mean)
> Time per request: 511.389 [ms] (mean)
> Time per request: 51.139 [ms] (mean, across all concurrent requests)
> Transfer rate: 908.05 [Kbytes/sec] received
>
> Connection Times (ms)
> min mean[+/-sd] median max
> Connect: 0 0 0.9 0 5
> Processing: 292 502 57.5 512 628
> Waiting: 287 438 51.4 449 563
> Total: 292 503 57.6 512 629
>
> Percentage of the requests served within a certain time (ms)
> 50% 512
> 66% 531
> 75% 544
> 80% 547
> 90% 575
> 95% 587
> 98% 609
> 99% 629
> 100% 629 (longest request)
----------------------------------------------------------------------
My conclusion:
When I compare the pain to program in PHP with the joy of programming in
Gambas, my opinion is clear:
Gambas is way better than PHP. It lets me develop easier, faster and I
can create better code which is more secure.
And in the example Gambas is called by Apache via CGI! If I'm done with
rewriting, I'd like to try to develop a FCGI-wrapper or test with a
generic one. Also intelligent caching can speedup things a lot (which
can be seen in the result of PHP on further runs).
And so my answer to this:
> php that is interpreted is so fast and popular instead of gambas
Is: No Picco, you're not right here, concerning performance.
Alles Gute
Christof Thalhofer
--
Dies ist keine Signatur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200104/7d87cf15/attachment.sig>
More information about the User
mailing list