fphttp slower with threads lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Trenatos · 2018-02-28 15:14 I'm playing with fphttp to create an API and comparing it to my usual stack of OpenBD (CFML engine running on the JVM), I also have a simple Java Spring API to compare with. I'm comparing them locally with WRK2 using Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i wrk2 -t2 -c100 -d30s -R2000 --latency http://localhost:7080/status/ In the process I've done both x86 and x64 with and without threads and had some odd results. Both architectures have about 13% less throughput when setting multithreading to true, and the x64 is a tad slower than the x86 version, but only by a little. Compared to my usual stack both have about 26% less throughput. I'm surprised that they're slower than the Java versions at all, that's a big disappointment as I was hoping for better performance with a native binary solution compared to Java, and I'm surprised that threading caused a drop in throughput. I ran each test a good handful of times and the average I got was: OpenBD - 1995 requests/sec Java Spring API - 1997 requests/sec FPC fphttp No threading x86 - 1560 requests/sec x64 - 1450 requests/sec FPC fphttp With threading x86 - 1480 requests/sec x64 - 1370 requests/sec Tested on my Macbook Pro. ---------------------------------------------------------------------- marcov · 2018-02-28 15:32 What does the Mac Brook  pro run?   Afaik OS X has several threading APIs,  (POSIX and native?), maybe it is merely a result of which API you pick. ---------------------------------------------------------------------- Trenatos · 2018-02-28 15:58 It's running OSX El Capitan System report: Model Name: MacBook Pro Model Identifier: MacBookPro11,5 Processor Name: Intel Core i7 Processor Speed: 2.5 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 6 MB Memory: 16 GB I'm using these options in my fpc app Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$ifdef darwin}cthreads,cmem,{$endif} ---------------------------------------------------------------------- Leledumbo · 2018-03-01 17:51 It actually also happens on Linux, using cthreads, with both tested and tester programs running on the same machine. I have yet to compare using server to server setup, to avoid any intra resource sharing problem, but I suppose fpc would shine in such a setup. ---------------------------------------------------------------------- Trenatos · 2018-03-01 18:22 I might give it a go under more proper server settings (Separate server instance from test machine, local network to avoid latency issues/spikes, etc.) I'll come back with results of my tests when I get a setup going.