おことわり:これはコミュニティから来た任意の人によって作られた非公式なコメントです。私はio.jsの公式な代表ではありません。何か質問がある人はnode-forward
discussionsリポジトリのissueを開いて下さい
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 http = require('http'); | |
server = http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'text/plain'}); | |
res.end('Hello World\n'); | |
server.close(); | |
}); | |
server.listen(8080, 0, function () { | |
console.log('Server running at http://localhost:8080/'); | |
}); |
Node v0.10の新しいとこを3行程度でまとめてみる。
- Streams2出ました。Streams1よりも扱いやすく、拡張しやすいよ。あとfs/read-streamがかなり改善されてる。最大1700%up。
- process.nextTickが高速化されたり、GCが安定してる。あとDomainモジュールがUnstableのstatusに昇格。
- モジュールの安定を望むためにCIでJenkins使うことにしたよ、 http://jenkins.nodejs.org/ でwatchできるよ。
あと、今後の話として、次はv0.12を目処にhttpモジュールの改善を入れていく予定。 その次はv1.0を目指したい。バグ修正や安定化を継続的に入れて行きたい。
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
module.exports = function (grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
express: { | |
dev: { | |
options: { | |
script: 'app.js', | |
port: 3000, | |
delay: 1000, | |
output: ".+" |
$ curl -L git.io/nodebrew | perl - setup
write this in your bashrc or zshrc.
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
dstat入れた => リソース状況調査 | |
$ sudo yum install dstat | |
mysqlのslow query log取ろうと思ったけど、よくわからないまま、色々やってた。 | |
my.cnfをいじってみた。 | |
弄る前に場所を確認 |
今回はDB接続周りの話
database接続に関してはGolangは標準パッケージにDB接続用のモジュールが存在する。
http://golang.org/pkg/database/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
curl "http://npmsearch.com/query?q=dom&fields=name" |
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 cluster = require('cluster'); | |
var http = require('http'); | |
var numCPUs = require('os').cpus().length / 2; | |
var numWorkers = numCPUs <= 1 ? 2 : numCPUs; | |
var watch = require('watch'); | |
var domain = require('domain'); | |
var util = require('util'); | |
var forceKilledWorkers = {}; |