2016-11-30

Websocket Benchmark

Once again, today I found another benchmark, about websocket:

Round #1

Language Clients RAM (MB) RAM / Client (KB) LOC Library
C++ 33,000 600 18.62 140 https://github.com/zaphoyd/websocketpp
Clojure  27,000 1,500 56.89 50 http://www.http-kit.org/
Elixir 24,000 1,900 81.07 20 http://www.phoenixframework.org/
Go 24,000 800 34.13 100 Built-in golang.org/x/net/websocket
NodeJS 13,000 300 23.63 31 https://github.com/websockets/ws
JRuby 1,100 650 605.09 20 http://rubyonrails.org/
Ruby 500 150 307.20 20 http://rubyonrails.org/

Round #2

Language Version Thread Clients Clients (without Payload)
Javascript / Node / uws 6.6.0
26,000
Haskell - no chan 1.2
25,000 37,000
C++ / uWebSockets / RapidJSON 5.4.0 1 24,000 35,000
Go / Websocket 1.7
22,000 39,000
C++ / Crow / RapidJSON 5.4.0 1 20,000
Go / Gorilla 1.7
20,000
Java / Netty 1.8.0_101
20,000
Rust - ws 1.11.0
20,000
Elixir / Plug 1.3.2
19,000
Java / Undertow 1.8.0_101
19,000
NodeJS / Faye - clustered 6.6.0
19,000
Rust - scopedpool-ws 1.11.0
19,000
Clojure / Java 1.8.0_101
18,000
C++ / WebsocketPP / jsoncpp 5.4.0 8 17,000
JRuby / Eventmachine 9.1.2.0
17,000
Rust - threadpool-ws 1.11.0
17,000
Elixir / Phoenix 1.3.2
15,000
C++ / Crow / RapidJSON 5.4.0 8 14,000 42,000
Javascript / Node / ws 6.6.0
14,000
Javascript / Node / ws - clustered 6.6.0
14,000
C++ / WebsocketPP / jsoncpp 5.4.0 1 13,000
Haskell 1.2
13,000
NodeJS / Faye 6.6.0
13,000
Ruby / Eventmachine 2.3.1p112
13,000
Javascript / Node / uws - clustered 6.6.0
12,000
JRuby / Rails 9.1.2.0
1,000
Ruby / Rails 2.3.1p112
500

You can see the raw result here.


2016-11-29

Sinatra-like Web Framework Benchmark

So today I come across some benchmark about sinatra-like web framework at 20 July 2016, it compares:



You can see the details here.

2016-11-28

Installing AeroSpike on ArchLinux

As benchmarked previously (more than half year ago since this blog post written), AeroSpike has awesome search/retrieval performance. In this tutorial we will learn how to install AeroSpike on ArchLinux

wget -O aerospike.tgz 'http://aerospike.com/download/server/latest/artifact/tgz'
tar -xvfz aerospike.tgz
cd aerospike-server
./bin/aerospike init

Configure the etc/aerospike.conf into something like this:

service {
  user YOUR_USERNAME
  group YOUR_GROUP
  run-as-daemon
  paxos-single-replica-limit 1 
  pidfile /home/YOUR_USERNAME/aerospike-server/var/run/aerospike.pid
  transaction-queues 8
  transaction-threads-per-queue 8
  transaction-pending-limit 255 # HOT KEY ERROR WORKAROUND FOR INCREMENT
  proto-fd-max 15000
  work-directory /home/YOUR_USERNAME/aerospike-server/var
}

logging {
  file /home/YOUR_USERNAME/aerospike-server/var/log/aerospike.log {
    context any info
  }
}

mod-lua {
  system-path /home/YOUR_USERNAME/aerospike-server/share/udf/lua
  user-path /home/YOUR_USERNAME/aerospike-server/var/udf/lua
}

network {
  service {
    address any
    port 3333 # USE DIFFERENT PORT IF CONFLICT 
    #reuse-address # COMMENT/REMOVE THIS PART
  }
  heartbeat {
    mode multicast
    multicast-group 239.1.99.222 # CHANGE address INTO multicast-group
    port 9918
    interval 150
    timeout 10
  }
  fabric {
    port 3331 # USE DIFFERENT PORT IF CONFLICT 
  }
  info {
    port 3332 # USE DIFFERENT PORT IF CONFLICT 
  }
}

namespace test {
  replication-factor 2
  memory-size 4G # CHANGE DEPENDS ON YOUR RAM
  default-ttl 0 # CHANGE 30 days, use 0 to never expire/evict.
  storage-engine device {
    file /home/YOUR_USERNAME/aerospike-server/data
    filesize 128M # MAX SIZE OF EACH FILE
  }
}

Then start the server:

./bin/aerospike restart
tail -f var/log/aerospike.log &
./bin/aerospike status

First and last command should show something like this:

info: stopped
info: started
info: process running

Done, now you can test your aerospike server using any client :3

2016-11-25

How to become AUR package adopter?

AUR is ArchLinux User Repository, similar to Ubuntu's Launchpad.
To adopt an orphaned package it's easier than you think! adopt now :3


What you need to do is register, find an orphaned package, then click on the "Adopt Package" link.


Don't forget to set your public key on your "My Account" menu.


After that you can clone the repository, see "Git Clone URL" on the first line of the package, edit and reupload:

git clone ssh://aur@aur.archlinux.org/bla.git
# do some changes on PKGBUILD
git add .
git commit -m 'updated bla package to version X'
git push origin master

Done :3 you have successfully adopt and maintain a package :3

2016-11-24

Bootstrap Alternative

Today we're gonne see more alternative of css framework such as Bootstrap (and JQuery UI)

Semantic UI

Pure.css (by Yahoo)

Foundation

UIKit


How about a nice Editor for CSS?

EnjoyCSS (web based)

Stylizer (mac, 79$)

MacRabbit Expresso (mac, 75$)

Responsive Site Designer (windows, mac, 189$)

SimpleCSS (windows, mac)

Koala (windows, mac, linux)
if you have trouble running, do this:
sudo ln -s /lib64/libudev.so.1 /lib64/libudev.so.0

StyleMaster (windows, mac, 59$)

Rapid CSS Editor (windows, 29$)

EnginSite CSS Editor (windows, 109$)

HTML Pad (windows, 35$)


Forget about bootstrap, how about if I don't know anything about CSS at all?

CSS Reference

CSS Almanac

Flexbox CheatSheet

Learn CSS Layout

How to Learn CSS in 24 Hours


But what if I want more than just CSS Framework? I demand GUI! (warning: mostly slow load)

Qooxdoo

DHTMLX

Dojo Toolkit

KendoUI

WebIX

WinJS

W2UI

ExtJS ($4000+)

VueJS Components

ReactJS Components


B-b-but I like Bootstrap, is there any GUI Builder?

LayoutIt

BootPly

Brix.io (14$)

JetStrap

PineGrow (desktop,  25$+)

Pingendo (desktop)

BootstrapStudio (25$)

Bootstrap Website Builder (windows, mac)

Lavish (customize color theme from a picture)

BootsWatchr or BootstrapMagic or Cluckles (bootstrap realtime preview)

BootUI (mac, windows, 49$)

Frontenda

Mobirise Website Builder (windows, mac, 145$)

BootstrapEditor (templates)

CodePly

BootTheme

well, that's it for now.. btw here's a comic about fullstack~




2016-11-17

Best Golang IDE: IntelliJ and VSCode

I've been using IntelliJ + go-lang-idea-plugin for years now (because it's currently the best one for almost everything: Ruby, PHP, Python, Javascript, SQL, you name it..), previously it's ok to use SublimeText + GoSublime, or LiteIDE, but today we got another completely working alternative that is also purely free (like IntelliJ Community): VisualStudioCode + lukehoban.Go. Here's how to install in ArchLinux:

yaourt --needed --noconfirm -S --force visual-studio-code 
go get -u -v github.com/nsf/gocode      
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
code

Then press Ctrl+Shift+P, type "Install Extension", type: "Go", done :3

Everything's works fine now:

In my opinion, IntelliJ still the best, but surely I'll be using VSCode when my IntellJ license ends.

2016-11-16

Techempower Framework Benchmark Round 13

After long wait, the latest Techempower Framework Benchmark 13 is out! And just like previous one, Go's fasthttp really really fast. As usual the most important thing is data updates benchmark:


Top ranker in this part (more than 1024 req/s) are GoC++JavaJavascript (NodeJS)PerlC#, ElixirDartScalaPythonClojure, and Groovy (Actually PHP are there below the last one on the picture with 1018 req/s). And for the database part would be: PostgreSQL, MongoDB, and MySQL.

2016-11-14

Crystal Internal Benchmark (Nov 2016)

Update the snapshot of benchmark by Kostya. See the previous (April 2015) snapshot here.

  • gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
  • Nim Compiler Version 0.14.0 (2016-06-06) [Linux: amd64]
  • Crystal 0.19.2 [d81c32c] (2016-09-16)
  • go version go1.7 linux/amd64
  • gccgo (Ubuntu 4.9.1-0ubuntu1) 4.9.1
  • DMD64 D Compiler v2.068.0
  • gdc (crosstool-NG crosstool-ng-1.20.0-232-gc746732 - 20150830-2.066.1-dadb5a3784) 5.2.0
  • LDC - the LLVM D compiler (0.15.2-beta1)
  • V8 version 3.29.62 (candidate)
  • rustc 1.11.0 (9b21dcd6a 2016-08-15)
  • Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45)
  • Nodejs v7.0.0
  • PyPy 4.0.0 with GCC 4.8.4
  • topaz (ruby-1.9.3p125) (git rev b95c858) [x86_64-linux]
  • ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
  • Python 2.7.6 and  3.5.2
  • rubinius 2.2.10 (2.1.0 bf61ae2e 2014-06-27 JI) [x86_64-linux-gnu]
  • jruby 1.7.20 (1.9.3p551) 2015-05-04 3086e6a on Java HotSpot(TM) 64-Bit Server VM 1.8.0_45-b14 +jit [linux-amd64]
  • jruby 9.0.0.0.pre2 (2.2.2) 2015-04-28 2755ae0 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [linux-amd64]
  • Java version "1.8.0_45" Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
  • julia version 0.4.3
  • clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
  • Mono JIT compiler version 4.0.1 (tarball Tue May 12 15:39:23 UTC 2015)
  • rock 0.9.10-head codename sapphire, built on Wed Jul 1 20:09:58 2015
  • Felix version 15.04.03
  • Q KDB+ 3.3 2015.09.02 Copyright (C) 1993-2015 Kx Systems
  • perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
  • The Glorious Glasgow Haskell Compilation System, version 7.10.2
  • Tcl 8.6
  • jq version 1.3
  • Swift version 2.2-dev (LLVM ae2eb212e4, Clang ef4c02f431, Swift 634acb40a1)
  • Kotlin version 1.0.3 (JRE 1.8.0_45-b14)
  • PHP 7.0.9-1+deb.sury.org~trusty+1 (cli) ( NTS )
  • .Net Core 1.0.0-preview2-003121

Havlak loop finder
LanguageTime, sMemory, MiB
Crystal15.46443.2
Nim Gcc16.59484.3
Nim Clang16.91477.9
C++17.72174.5
D Ldc25.15214.9
D28.90418.2
Go31.26349.9
D Gdc31.79197.6
Scala32.18363.0
Go Gcc32.94365.7
C# Mono40.54270.0
Python Pypy45.51625.9
C# .Net Core61.38388.8
Python396.54724.0

Matrix multiplication
LanguageTime, sMemory, MiB
Julia Native Thr0.11148.3
Julia Native0.31175.8
D Mir GLAS0.3256.7
D Ldc2.0168.9
D2.3071.3
D Gdc2.3373.0
Python Numpy3.0865.3
Java3.50136.2
Scala3.62136.2
Kotlin3.62132.2
C3.6469.2
Nim Clang3.73142.3
Rust3.7476.9
Nim Gcc3.82146.0
Go3.8373.5
Crystal3.8573.9
Go Gcc3.9084.5
Swift4.48110.8
Javascript Node5.9588.3
Javascript V86.8781.5
Python Pypy7.68122.6
C# .Net Core10.8785.7
C# Mono15.1783.6
Julia20.98187.4
Ruby Topaz81.41206.2
Ruby338.4082.8
Python447.3974.0
Ruby JRuby416.12582.4
Ruby JRuby9k467.59608.3
Ruby Rbx591.70325.0
Perl666.46604.1
Tcl1066.66279.9

JSON parse
LanguageTime, sMemory, MiB
D Gdc Fast0.34226.7
C++ Rapid SAX0.721.0
Rust Pull0.78207.9
Rust Struct0.79232.5
C++ Gason0.83582.2
C++ Rapid0.94243.6
Java1.47621.2
Crystal Schema1.93331.2
Rust Value2.511967.0
Perl XS2.68888.4
Crystal3.001115.2
Javascript Node3.21863.7
Crystal Pull3.301.6
Nim Clang4.121089.6
Python3 ujson4.151303.2
Nim Gcc4.461090.1
Python Pypy4.811553.0
Python ujson5.071352.9
Q5.18684.0
Go5.21479.3
C++ LibJson5.492796.3
Clojure5.811148.5
Python35.821037.8
C# .Net Core6.31834.9
Php6.371502.0
Ruby YAJL8.231085.5
Haskell8.3170.5
Python9.851409.1
C# Mono10.57812.1
Julia11.892622.4
D12.421417.1
Ruby12.672013.9
JQ14.921714.5
Scala15.471415.8
C++ Boost16.442915.2
Ruby JRuby9K16.532050.5
Go Gcc17.64473.1
Ruby JRuby21.982761.1
D Gdc25.86926.1
D Ldc27.23919.6
Perl46.021635.4
Ruby Rbx67.134681.0

Base64 encode and decode

LanguageTime, sMemory, MiB
C aklomp SSSE30.9332.3
C1.8532.2
Crystal2.3085.0
D Gdc2.5233.3
Ruby2.73125.3
D Ldc3.1453.1
Perl XS3.6347.9
Rust3.6442.9
Ruby Rbx4.2930.7
Nim Gcc4.6252.7
Nim Clang4.7052.7
Julia4.41190.0
Javascript Node4.76551.5
C++ Openssl5.4565.2
Php6.3453.4
C# .Net Core6.52121.1
D7.1855.3
Tcl7.2066.0
Python Pypy7.32582.3
Python7.6252.6
Go8.0070.0
Python38.1354.5
C# Mono9.0171.7
Java9.06971.2
Kotlin9.75932.9
Scala10.69292.5
Ruby JRuby9K12.16530.6
Ruby JRuby12.65514.9
Perl33.3099.7
Go Gcc39.56185.5
Mandelbrot in Brainfuck
LanguageTime, sMemory, MiB
C++ Gcc20.491.7
Crystal23.131.5
D Ldc24.901.4
Rust25.194.9
D Gdc29.492.4
Nim Gcc31.042.7
Nim Clang37.392.9
Go Gcc37.5911.4
Kotlin40.7934.9
Scala58.51120.12
Java58.86423.9
D Dmd62.691.7
Javascript Node88.3418.6
Go102.852.2
Python Pypy126.4778.9
C# .Net Core142.3017.8
C# Mono147.6912.6
Ruby Topaz305.7938.8

Brainfuck interpreter
LanguageTime, sMemory, MiB
Kotlin1.7828.4
C++ Gcc1.941.0
D Ldc2.020.9
Rust2.494.9
Nim Gcc2.560.7
D Gdc3.051.4
Nim Clang3.090.8
Scala3.43120.12
Crystal3.461.3
Java4.03513.8
Go Gcc4.2010.0
D Dmd5.231.0
Go5.360.9
Javascript V86.537.9
Javascript Node7.3816.9
C# .Net Core16.0316.9
C# Mono19.8614.6
Python Pypy20.6477.9
Ruby Topaz59.5336.5
Ruby Rbx120.3832.3
Ruby Jruby129.75267.6
Ruby Jruby9k134.18286.8
Ruby181.447.2
Python314.794.9
Python3412.135.5