Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a7e4b3

Browse files
committed
pm2 setup to manage process
1 parent458f3b5 commit0a7e4b3

File tree

4 files changed

+1555
-7
lines changed

4 files changed

+1555
-7
lines changed

‎15. event loop/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
process.env.UV_THREADPOOL_SIZE=5;
1+
process.env.UV_THREADPOOL_SIZE=1;
22
constexpress=require("express");
33
constcluster=require("cluster");
44
constcrypto=require("crypto");
@@ -10,9 +10,11 @@ if (cluster.isMaster) {
1010
// Cause index.js to be executed again but in child mode
1111
// creating the 4 NODE instances means 4 event loops
1212
cluster.fork();
13-
//cluster.fork();
14-
// cluster.fork();
15-
// cluster.fork();
13+
cluster.fork();
14+
// cluster.fork();
15+
// cluster.fork();
16+
// cluster.fork();
17+
// cluster.fork();
1618
}else{
1719
// I am a child, I am going to act like a server and do nothing else
1820

@@ -24,12 +26,12 @@ if (cluster.isMaster) {
2426
}
2527

2628
app.get("/",(req,res)=>{
27-
wait5min(10000);
29+
//wait5min(10000);
2830
returnres.status(318).send("HELLO");
2931
});
3032

3133
app.get("/slow",(req,res)=>{
32-
wait5min(8000);
34+
//wait5min(8000);
3335
returnres.send("slow");
3436
});
3537

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp