Based on tests on my machine (2013 MacBook Pro, 2.6 GHz i7, 16 GB RAM) generated by https://github.com/pragdave/map_performance
Elixir v1.0.4
| import json | |
| from enum import Enum | |
| from utils.logging import get_logger | |
| logger = get_logger(__name__) | |
| class Pattern(Enum): | |
| # OPTIONAL = 0 |
| With this script you can turn your jar file into a service on linux. | |
| Change the MATH constant to the name of your application and make sure you are correctly specifying | |
| the locationsof the files used in the variables. | |
| For the correct operation of the script install it in the directory init.d and release its access as below: | |
| chmod 755 *your_script* |
| #!/usr/bin/env bash | |
| SL=/etc/apt/sources.list | |
| PARAM="r:hm:dnak" | |
| KAKAO=mirror.kakao.com | |
| KAIST=ftp.kaist.ac.kr | |
| HARU=ftp.harukasan.org |
| 'use strict'; | |
| //npm install gulp gulp-minify-css gulp-uglify gulp-clean gulp-cleanhtml gulp-jshint gulp-strip-debug gulp-zip --save-dev | |
| var gulp = require('gulp'), | |
| clean = require('gulp-clean'), | |
| cleanhtml = require('gulp-cleanhtml'), | |
| minifycss = require('gulp-minify-css'), | |
| jshint = require('gulp-jshint'), | |
| stripdebug = require('gulp-strip-debug'), |
Based on tests on my machine (2013 MacBook Pro, 2.6 GHz i7, 16 GB RAM) generated by https://github.com/pragdave/map_performance
Elixir v1.0.4
| #!/usr/bin/env escript | |
| -define(VERSION, 16#05). | |
| -define(CONNECT, 16#01). | |
| -define(NO_AUTH, 16#00). | |
| -define(RESERVED, 16#00). | |
| -define(ATYP_IPV4, 16#01). | |
| -define(ATYP_DOMAINNAME, 16#03). |
| sudo apt-get install libsnappy-dev | |
| wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz | |
| tar -xzf leveldb-1.9.0.tar.gz | |
| cd leveldb-1.9.0 | |
| make | |
| sudo mv libleveldb.* /usr/local/lib | |
| cd include | |
| sudo cp -R leveldb /usr/local/include |
| #!/bin/bash | |
| # Pull this file down, make it executable and run it with sudo | |
| # wget https://raw.github.com/gist/5487621/build-erlang-r16b.sh | |
| # chmod u+x build-erlang-r16b.sh | |
| # sudo ./build-erlang-r16b.sh | |
| if [ $(id -u) != "0" ]; then | |
| echo "You must be the superuser to run this script" >&2 | |
| exit 1 | |
| fi |
This is the most basic example of vertical scaling by transferring connections to workers, rather than sharing server sockets. It was presented at JSConf US 2012. With this you can create some interesting balancing algorithms that cluster would defer to internal/OS logic.
A good first project when working with this is to implement sticky sessions based upon connection.remoteAddress and/or connection.remotePort.
A good advanced project is to change from a TCP based balancer to a HTTP(S) one and balance based upon not just connection.remoteAddress etc. but also on the protocol and/or Host header.
| %% pretty print timestamp from lager/src/lager_utils.erl | |
| localtime_ms() -> | |
| {_, _, Micro} = Now = os:timestamp(), | |
| {Date, {Hours, Minutes, Seconds}} = calendar:now_to_local_time(Now), | |
| {Date, {Hours, Minutes, Seconds, Micro div 1000 rem 1000}}. | |
| format_time() -> | |
| format_time(localtime_ms()). |