#1 2017-03-29 04:20:45

Del
Member
Registered: 2017-03-24
Posts: 20

Mormot winhttp client(s) with node.js express backend error 12002

I am doing a POC using mormot winhttp, json serializing to a local node.js express service.  To test resilience, performance I execute two instances of test app (using winhttp performing in order of 1000 sequential POST's from each client concurrently) to EXPRESS service (all running on the same computer) and am finding that 1 client works fine but when i initiate POST from two clients simultaneously one client inevitably throws a Winhttp 12002 (operation timed out) error. Anyone have any experience with this, I am either 'abusing / misconfiguring' winhttp or have neglected to configure EXPRESS properly as it surely should not crumble under these conditions.

Initializing and POST request using winhttp is as follows

fclient := TWinHTTP.Create('localhost', '3002', False, EmptyStr,EmptyStr, 10000,10000,10000);

res := fclient.Request('test', 'POST', 0, Hdr.Header, EmptyStr, EmptyStr, outHDr, OutData);

Offline

#2 2017-03-29 10:41:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,244
Website

Re: Mormot winhttp client(s) with node.js express backend error 12002

Each thread as its own TWInHTTP instance?

Offline

#3 2017-03-29 10:47:11

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,544
Website

Re: Mormot winhttp client(s) with node.js express backend error 12002

Looks like your node app is slow smile Try to add a cluster module (https://nodejs.org/api/cluster.html#clu … w_it_works) to your node app

Offline

#4 2017-03-29 10:47:13

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Mormot winhttp client(s) with node.js express backend error 12002

Sorry Arnaud I am not following your train of thought... what are you suggesting? Nothing obviously wrong with the above then and you would expect the same as I would from the POC?

Offline

#5 2017-03-29 10:50:09

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Mormot winhttp client(s) with node.js express backend error 12002

Very interesting mpv, thanks for that, will definitely give it a go! I would have thought it shouldn't struggle though since I am doing quite basic operations, each POST insert a very basic record into a db.

Last edited by Del (2017-03-29 10:52:45)

Offline

#6 2017-03-29 22:55:03

Del
Member
Registered: 2017-03-24
Posts: 20

Re: Mormot winhttp client(s) with node.js express backend error 12002

Just in case this helps others... Issue turned out to be some blocking behaviour I implemented when committing to the database (not a node issue at all). I took the opportunity to implement clustering though and am thoroughly impressed with throughput and resilience gained from clustering.

Offline

#7 2017-03-30 07:19:36

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,544
Website

Re: Mormot winhttp client(s) with node.js express backend error 12002

@Del - in fact mORMot based server will be faster compared to node cluster (at last under Windows with HTTP API based server. I'm not check the latest WSAPoll based implementation)

Offline

Board footer

Powered by FluxBB