Created
July 9, 2020 13:25
-
-
Save owenrh/caf439d7c8612179f41d8af3b103c78a to your computer and use it in GitHub Desktop.
Apache & node.js experiments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
// sleep time expects milliseconds | |
function sleep (time) { | |
return new Promise((resolve) => setTimeout(resolve, time)); | |
} | |
app.get('/', (req, res) => { | |
sleep(20000).then(() => { | |
res.send('Hello World!') | |
}); | |
}); | |
// app.listen(port, "localhost", () => console.log(`Example app listening at http://localhost:${port}`)) | |
server = app.listen(port, "localhost", 1024, () => console.log(`Example app listening at http://localhost:${port}`)) | |
server.keepAliveTimeout = 61 * 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config: | |
environments: | |
dev: | |
phases: | |
- duration: 10 | |
arrivalRate: 3 | |
test: | |
phases: | |
- duration: 120 | |
arrivalRate: 150 | |
scenarios: | |
- name: "Hit the page" | |
flow: | |
- get: | |
url: "/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ListenBacklog 799 | |
<IfModule mpm_event_module> | |
StartServers 8 | |
#MinSpareServers 8 | |
#MaxSpareServers 16 | |
MaxRequestWorkers 800 | |
ServerLimit 8 | |
MaxClients 800 | |
MaxRequestsPerChild 0 | |
ThreadsPerChild 100 | |
ThreadLimit 100 | |
MinSpareThreads 100 | |
MaxSpareThreads 800 | |
</IfModule> | |
... | |
<VirtualHost *:80> | |
ServerName example.com | |
ProxyRequests off | |
ProxyPass / http://localhost:3000/ acquire=1000 timeout=60 Keepalive=On | |
ProxyPassReverse / http://localhost:3000/ | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment