Total Pageviews

Friday 21 September 2018

一个轻量级的高性能的http server程序-julia


 Build Status

A small yet high performance http server and reverse proxy. You may view it as a tiny nginx.

Environment

  • gcc 5.4.0
  • linux 4.4.0

Dependency

Install

  $ git submodule update --remote --recursive
  $ cd src && make all
  $ make install # root required

Run

$ julia # roo required, default listening at 8000
You may modify the config file to specify the port if there is a confliction.

Debug

As julia run as a daemon, it is not convenient to debug. Follow the steps to make it run in debug mode:
  1. change the INSTALL_DIR in Makefile to your local repo, like:
INSTALL_DIR = /home/foo/julia/ # the last slash required
  1. turn on the debug instruction in config.json
"debug": true,

Exciting

Making a http server and host your site is not extremely cool? Then, what if your server is compiled by your own compiler?
Yes, i wrote a C11 compiler(let me call it wgtcc). It compiles julia, and the site runs well :) You can install wgtcc, then compile julia:
  $ make CC=wgtcc all
It surprised me that the server compiled by wgtcc runs extremely fast!
have fun :)

Todo

  1. fastcgi
  2. chunked transform
  3. benchmark

Reference

  1. nginx
  2. lighttpd
  3. juson

中文

julia 是一个短小精悍的高并发http服务器和反向代理。你可以将他想象成tiny nginx。我用它搭了博客。静态文件由julia serve, 动态内容pass到后端的uwsgi(类似于fpm)。
安装 调试 请参照上方。
最酷的是,这个服务器,包括正在运行的博客,都是我自己写的C编译器编译的。如果你对编译器也感兴趣,可以看这里。按照其readme安装wgtcc后,你可以这样编译julia:
  $ make CC=wgtcc all
have fun :)
from https://github.com/wgtdkp/julia

No comments:

Post a Comment