Am 25.11.2015 um 15:24 schrieb Andrew Chapman:
On Tue, 24 Nov 2015 18:01:59 GMT, Adam Strzelecki wrote:
Hello,
I am an author of some more lightweight benchmark WebFrameworkBenchmark, it is much simpler but also more friendly benchmark than Techempower's Benchmark.
I wanted to ask you to have a look at my Vibe.d results, which are pretty disappointing, just below Ruby performance and far below C and Java frameworks. Vibe.d looks really nice, it has interesting features, but its performance really needs some love (aka optimizations).
Yeah I found the same. I really want to use D for web API development, but the benchmarks are currently not encouraging.
I wrote a simple function that loads 100 records from MySQL, populates some structs with said data, and then json encodes the lot as output. I then wrote the same in PHP and used Apache bench to benchmark 100,000 requests with a concurrency of 10. Essentially the D / Vibed solution was slightly slower than PHP. PHP does have a fast / efficient JSON encoder and I know D's JSON encoder isn't the best, but still...
Does anyone know if the performance is something that can/will be improved anytime soon?
There are some main points outside of the HTTP server where performance
may get lost:
- MySQL driver
- Assembly of the structs
- Converting to JSON
I don't know about the performance of the MySQL driver, but what did you
use for the other two steps? The conversion to JSON, if you use res.writeJsonBody(struct_data)
, should be pretty optimal speed-wise.
But the SQL query and converting the data representation might easily
make heavy use of the GC, which currently is the number one enemy of a
performant server.
Since it's a stop-the-world collector, it will destroy all concurrency
benefits of a multi-thread setup and its collection cycle can lead to
connection drops/timeouts under heavy load.
This doesn't mean that the GC must be avoided at all costs, but the
amount of allocations that happen per request should be reduced to a
minimum by using stack allocation, ranges, free lists and similar means.