-1

I have a method that contains a for loop, and I have the main process and child processes calling this method.

20404 create:  2022-01-14 05:44:10.073
20404 create:  2022-01-14 05:44:10.075
20404 create:  2022-01-14 05:44:10.077
20404 create:  2022-01-14 05:44:10.077
send: 2022-01-14 05:44:10.078
send: 2022-01-14 05:44:10.079
send: 2022-01-14 05:44:10.079
16228 get  2022-01-14 05:44:10.081
11976 get  2022-01-14 05:44:10.081
9692 get  2022-01-14 05:44:10.082
11976 create:  2022-01-14 05:44:10.087
9692 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.113
9692 create:  2022-01-14 05:44:10.114
16228 create:  2022-01-14 05:44:10.116
11976 create:  2022-01-14 05:44:10.116
9692 create:  2022-01-14 05:44:10.117
16228 create:  2022-01-14 05:44:10.119
11976 create:  2022-01-14 05:44:10.121
11976 create:  2022-01-14 05:44:10.123

Above are logs, send is when main process sends the instruction to child process.

The first four lines are printed out from the main process, 2ms on average between every iteration

get is when a child process gets the instruction.

The first number is the process id. As you can see at this part:

11976 create:  2022-01-14 05:44:10.087
9692 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.087
16228 create:  2022-01-14 05:44:10.113
9692 create:  2022-01-14 05:44:10.114
16228 create:  2022-01-14 05:44:10.116

The time gap between those two iterations is huge compared to the rest time gaps. Any ideas why this is happening?

Carl.W
  • 1
  • 3
  • Btw, I am using Cluster module – Carl.W Jan 15 '22 at 01:58
  • What do I have to do to reproduce this? – Wyck Jan 15 '22 at 02:06
  • I am not sure if you can reproduce this, but I am doing async calls in every iteration. What's strange is that only the first two iterations' time gap is long. Not sure if this is a hardware issue or node issue – Carl.W Jan 15 '22 at 03:41
  • Please show the relevant code for a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) and describe how you're creating the multiple requests. – jfriend00 Jan 15 '22 at 03:56
  • How many clustered processes? – jfriend00 Jan 15 '22 at 04:08
  • The logs would be a lot easier to decipher if each request was tagged somehow so you could see which create, send and get are the same request. – jfriend00 Jan 15 '22 at 04:09
  • 3 child processes and you can tell by the number at the beginning of every line. Btw I posted an answer myself – Carl.W Jan 15 '22 at 05:26
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jan 24 '22 at 08:42

1 Answers1

0

When I first created the child process the first run was always slow, so I had to send some dummy data to make it run a few times before it receives the actual data. In that way, when the actual request data comes in, the time gaps between iterations become small and consistent. Maybe it is just a node problem

Carl.W
  • 1
  • 3