import { dirname, extname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import Fastify from 'fastify'
-import { availableParallelism } from 'poolifier'
import { fastifyPoolifier } from './fastify-poolifier.js'
+/**
+ * The fastify server is still a single-threaded application, but the request handling can be multi-threaded.
+ */
+
const port = 8080
const fastify = Fastify({
logger: true
await fastify.register(fastifyPoolifier, {
workerFile,
- minWorkers: 1,
- maxWorkers: availableParallelism(),
enableTasksQueue: true,
tasksQueueOptions: {
concurrency: 8