Skip to content

Commit

Permalink
Fix use the physical CPU count from Fastify (TechEmpower#7988)
Browse files Browse the repository at this point in the history
  • Loading branch information
JHyeok authored Mar 7, 2023
1 parent 062ab19 commit fe2ff26
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions frameworks/JavaScript/fastify/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const cluster = require("cluster");
const numCPUs = require("os").cpus().length;
const physicalCpuCount = require("physical-cpu-count")

if (cluster.isPrimary) {
console.log(`Primary ${process.pid} is running`);

// Fork workers.
for (let i = 0; i < numCPUs; i++) {
for (let i = 0; i < physicalCpuCount; i++) {
cluster.fork();
}

Expand Down
2 changes: 1 addition & 1 deletion frameworks/JavaScript/fastify/fastify-mysql.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.12.1-alpine
FROM node:18.12.1-slim

COPY ./ ./

Expand Down
2 changes: 1 addition & 1 deletion frameworks/JavaScript/fastify/fastify-postgres.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.12.1-alpine
FROM node:18.12.1-slim

COPY ./ ./

Expand Down
2 changes: 1 addition & 1 deletion frameworks/JavaScript/fastify/fastify.dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.12.1-alpine
FROM node:18.12.1-slim

COPY ./ ./

Expand Down
3 changes: 2 additions & 1 deletion frameworks/JavaScript/fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"knex": "2.4.2",
"mongodb": "3.5.9",
"mysql2": "2.2.5",
"pg": "8.5.1"
"pg": "8.5.1",
"physical-cpu-count": "^2.0.0"
}
}

0 comments on commit fe2ff26

Please sign in to comment.