-
Libuv has a default thread pool size of 4, and uses a queue to manage access to the thread pool - the upshot is that if you have 5 long-running DB queries all going at the same time, one of them (and any other asynchronous action that relies on the thread pool) will be waiting for those queries to finish before they even get started.
-
Note, however, that tuning UV_THREADPOOL_SIZE may make more sense for a standalone application like a CLI written in Node.js. If you are standing up a bunch of Node.js processes using the cluster module then I would be surprised if tuning UV_THREADPOOL_SIZE was particularly beneficial for you. But if your application resembles the web tooling benchmarks then tuning UV_THREADPOOL_SIZE may help with performance.
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
"use strict"; | |
// https://expressjs.com/en/4x/api.html#res | |
const express = require("express"); | |
const app = express(); | |
const port = process.env.port || 3000; | |
app.set("view engine", "pug"); | |
app.set("views", process.cwd() + "/views"); | |
app.get("/", (req, res) => { | |
//handle route: get requests for "/" |
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 dns = require('dns'); | |
const http = require('http'); | |
const https = require('https'); | |
const tls = require('tls'); | |
const net = require('net'); | |
const request = require('request'); | |
const httpAgent = new http.Agent(); | |
const httpsAgent = new https.Agent(); |
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 http = require("http"); | |
const net = require("net"); | |
const server = http.createServer((req, res) => { | |
req.resume(); | |
res.end("hello"); | |
}); | |
server.keepAliveTimeout = 6 * 1000; | |
server.headersTimeout = 4 * 1000; |
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
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
mysql -u root -p epg < epg.sql |
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
http://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984 | |
rem and em units are computed into pixel values by the browser, based on font sizes in your design. | |
em units are based on the font size of the element they’re used on. | |
rem units are based on the font size of the html element. | |
em units can be influenced by font size inheritance from any parent element | |
rem units can be influenced by font size inheritance from browser font settings. | |
Use em units for sizing that should scale depending on the font size of an element other than the root. | |
Use rem units for sizing that doesn’t need em units, and that should scale depending on browser font size settings. |
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
var module = (function() { | |
var _private = { | |
i:5, | |
get : function() { | |
console.log( "current value:" + this.i); | |
}, | |
set : function( val ) { | |
this.i = val; | |
}, |
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
class Car { | |
constructor(options) { | |
this.doors = options.doors || 4; | |
this.state = options.state || "brand new"; | |
this.color = options.color || "silver"; | |
} | |
} | |
class Truck { | |
constructor(options) { |
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
var throttle = (function () { | |
return function (fn, delay) { | |
delay || (delay = 100); | |
var last = +new Date; | |
return function () { | |
var now = +new Date; | |
if (now - last > delay) { | |
fn.apply(this, arguments); | |
last = now; | |
} |
NewerOlder