Giter VIP home page Giter VIP logo

lapis-example's Introduction

Development

Install OpenResty, lua, luarocks

sudo apt-get install build-essential libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make
wget http://openresty.org/download/ngx_openresty-1.7.10.1.tar.gz
tar xzvf ngx_openresty-1.7.10.1.tar.gz
cd ngx_openresty-1.7.10.1/
./configure -j4 --with-pcre-jit --with-ipv6
make -j4
sudo make install

Once:

sudo apt-get install luarocks luajit
sudo luarocks install lapis

sudo apt-get install git-core
git clone https://github.com/slava-vishnyakov/lapis-example.git

cd openresty-example
git submodule init
git submodule update

echo http://$(wget -qO - http://api.ipify.org):8081/http_request
lapis server development

# org
lapis server production 2>/dev/null

Development:

sudo luarocks install moonscript
moonc -w src/ -t compiled/
lapis server development

Sources

Editable sources are in src/ https://github.com/slava-vishnyakov/lapis-example/blob/master/src/app.moon#L25

Benchmark

lapis server production 2>/dev/null

ab -k -c 2 -n 1000 http://localhost:8081/redis_counter
> Requests per second:    6400.61 [#/sec] (mean)
> 50%      0ms
> 99%      1ms

ab -k -c 2 -n 1000 http://localhost:8081/postgresql
> Requests per second:    3578.05 [#/sec] (mean)
> 50%      1
> 99%      1

ab -k -c 2 -n 1000 http://localhost:8081/postgresql/model
> Requests per second:    3172.43 [#/sec] (mean)
> 50%      1
> 99%      1

ab -k -c 5 -n 1000 http://localhost:8081/local_counter
> Requests per second:    6954.15 [#/sec] (mean)
> 50%      1
> 99%      1

ab -k -c 100 -n 100 http://localhost:8081/http_request
> Requests per second:    239.13 [#/sec] (mean) # depends on httpbin.org speed

curl -XPOST -d'{"test":1}' -H 'Content-Type: application/json' http://localhost:8081/post
> {"value_in_test":1}

GUI

Atom editor + language-moonscript

apm install language-moonscript

For Mac OS X

brew install pcre
./configure \
             --with-cc-opt="-I/usr/local/include" \
             --with-ld-opt="-L/usr/local/lib" \
             -j4
make -j4
sudo make install

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.