Skip to content

Instantly share code, notes, and snippets.

@jwchang0206
jwchang0206 / coinbine-nginx.Dockerfile
Created August 5, 2018 05:51
AWS ECS에서 Nginx - Node.js 웹서버 구성하기
# Dockerfile for Nginx
FROM fholzer/nginx-brotli:latest
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
@jwchang0206
jwchang0206 / Dockerfile-nginx
Created July 17, 2019 22:41
Docker nginx & node.js app
FROM fholzer/nginx-brotli:latest
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
@jwchang0206
jwchang0206 / nginx-tuning.md
Created July 17, 2019 22:59 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

extern crate rand;
use std::io;
use std::cmp::Ordering;
use rand::Rng;
fn main() {
println!("Guess the number!");
let secret_number = rand::thread_rng().gen_range(1, 101);
{
"name": "tweet-sentiment",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "",
const Twit = require('twit');
const Sentiment = require('sentiment');
// Create a sentiment instance
const sentiment = new Sentiment();
// Create a Twit instance
const T = new Twit({
consumer_key: 'consumer key obtained from twitter developer', // Twitter Developer - https://developer.twitter.com
consumer_secret: 'consumer secret obtained from twitter developer',
const { MongoClient } = require('mongodb');
const axios = require('axios');
const createStream = require('./tweetCrawler');
// Either take the MongoDB connection string from envrionment variable MONGODB_URL or the local mongodb 'twtsnt'
const url = process.env.MONGO_URL || 'mongodb://localhost:27017/twtsnt';
const dbName = 'twtsnt';
// Create a MongoDB client instance
const client = new MongoClient(url, { useNewUrlParser: true });
const express = require('express');
const helmet = require('helmet');
const { MongoClient, ObjectID } = require('mongodb');
const url = process.env.MONGO_URL || 'mongodb://localhost:27017/twtsnt';
const dbName = 'twtsnt';
let client = null;
const port = process.env.PORT || 3000;
const app = express();
worker_processes auto;
events {
worker_connections 1024;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;