Skip to content

Instantly share code, notes, and snippets.

@RickySu
Last active July 13, 2020 12:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RickySu/8edb9bcc58829e5478ac to your computer and use it in GitHub Desktop.
Save RickySu/8edb9bcc58829e5478ac to your computer and use it in GitHub Desktop.
hhvm-ext-uv benchmark

hhvm-ext-uv benchmark

Environment

  • OS: Ubuntu 14.04 X64
  • CPU: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
  • RAM: 8GB
  • go: go version go1.3 linux/amd64
  • nodejs: v0.10.30
  • HHVM: 3.1.0 and 3.2.0

Code for benchmark

go

package main

import (
    "fmt"
    "net/http"
)

func sayhelloName(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "Hello World")
}


func main() {
    http.HandleFunc("/", sayhelloName)                 
    http.ListenAndServe(":8080", nil)                 
}

nodejs

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World');
}).listen(8080, '127.0.0.1');

hhvm + hhvm-extuv

<?php
$server = new UVHttpServer('127.0.0.1', 8080);
$server->onDefaultRequest(function(UVHttpClient $client){
    $client->sendReply('Hello World hhvm');
    $client->setCloseOnBufferEmpty();
})
->start();
UVLoop::defaultLoop()->run();

ab -c 1000 -n 10000 http://localhost:8080

req/s higher is better

go 21175.09
nodejs 6769.41
HHVM 3.1.0 20404.50
HHVM 3.2.0 20521.41

ab -c 10000 -n 10000 http://localhost:8080

req/s higher is better

go 16980.44
nodejs fail! Total of 9507 requests completed
HHVM 3.1.0 15825.24
HHVM 3.2.0 16342.17

ab -c 15000 -n 15000 http://localhost:8080

req/s higher is better

go 16265.59
nodejs not test
HHVM 3.1.0 15883.72
HHVM 3.2.0 15656.72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment