the past, present, and future of openresty openresty 的过...

72
The Past, Present, and Future of OpenResty OpenResty 的过去、现在和未来 [email protected]章亦春 (agentzh) 2015.11

Upload: others

Post on 01-Oct-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

The Past, Present, and Futureof OpenResty

OpenResty 的过去、现在和未来

[email protected]章亦春 (agentzh)

2015.11

Page 2: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

I just wanted to builda personal blog...

最初我其实只想搭个

个人博客...

Page 3: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

search.yahoo.cn

Page 4: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

chaoslawful

Page 5: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

lz.taobao.com

Page 6: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty
Page 7: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

www.cloudflare.com

Page 8: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty
Page 9: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty
Page 10: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

API ServerHTTP Proxy

Web Application

Page 11: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

The all-inclusive philosophy

兼容并包的哲学

Page 12: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

SimpleSmallFast

Flexible

Page 13: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Pragmatism

实用主义

Page 14: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

-Ofun

Page 15: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Mailing listsGitHub

QQ GroupConferences

Page 16: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

"Programming OpenResty"

《OpenResty 编程》

Page 17: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Package Management

Page 18: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

iresty.org

Page 19: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

$ iresty install agentzh/resty.foo $ iresty remove agentzh/resty.foo $ iresty search bar

Page 20: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

$ restydoc resty.blah

Page 21: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

$ resty ­e 'ngx.say("Hello OpenResty!")'

Page 22: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Lua librariesOpenResty Applications

Page 23: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Limited LuaRocks Compatibility

Page 24: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

More official binary distributions

Page 25: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Windows

Page 26: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

UbuntuDebianFedoraCentOSRHEL...

Page 27: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

iresty.org -> binary packages

Page 28: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

TCP server support

Page 29: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

ngx_stream_echo_modulengx_stream_lua_module

Page 30: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

UDP server support

Page 31: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Templating

Page 32: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

lua-resty-tt2 (jemplate)

Page 33: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Streaming Regex

Page 34: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

libsregex(ngx_replace_filter)Intel HyperScan?

Page 35: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

lua-resty-pegex

Page 36: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

The Edge Language

Page 37: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

zone agentzh.org; host('cdn.agentzh.org'), uri­suffix(".swf") => redirect(host: "ajax.agentzh.org"), done;

Page 38: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Official WAF Platform

官方的 WAF 平台

Page 39: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

DSL -> highly optimized Lua

Page 40: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Stateful service support(DHT, gossip, CRDT)

Page 41: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

ngx.semaphore

Page 42: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

List-typed values in ngx.shared.DICT(Redis style)

Page 43: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Shm-based databases(relational, time-series, and etc)

Page 44: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

init_by_lua + cosockets

Page 45: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Better cosockets

Page 46: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

dgram_sock:bind()

Page 47: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Connection-pool basedconcurrency control and queueing

in cosockets.

Page 48: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

ngx.connection

Page 49: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

local connection = require "ngx.connection" local conn = connection.new(fd) conn:wait_read() conn:wait_write() conn:wait_rw()

Page 50: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Upstream

Page 51: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

balancer_by_lua

Page 52: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

upstream server 0.0.0.0; balancer_by_lua ' local balancer = require "ngx.balancer" local host, port = my_load_backend_addr() assert(balancer.set_cur_peer(host, port)) ';

Page 53: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

SSL

Page 54: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

ssl_certificate_by_lua

Page 55: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty
Page 56: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

ssl_session_fetch_by_luassl_session_store_by_lua

Page 57: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

SSL session ticket key rotation

Page 58: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

LuaJIT

Page 59: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

New LuaJIT GC

Page 60: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

string.buffer

Page 61: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Dialects for Perl/Python/Ruby/PHPatop LuaJIT

Page 62: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Debugging

Page 63: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

gdb (breakpoints, GC, stack)

Page 64: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

systemtap(stap++, nginx-systemtap-toolkit)

Page 65: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

lldb(from LLVM)

Page 66: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

eBPF(Linux)

Page 67: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

The Y Language

Page 68: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

$ ylang ­Tgdb ­o foo.py foo.y $ ylang ­Tlldb ­o foo.py foo.y $ ylang ­Tstap++ ­o foo.sxx foo.y $ ylang ­Tebpf ­o foo foo.y

Page 69: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Mozilla rr

Page 70: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Test::Nginx::Socket (DSL again)

Page 71: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

Any questions?

欢迎提问

Page 72: The Past, Present, and Future of OpenResty OpenResty 的过 …agentzh.org/misc/slides/The-Past-Present-and-Future-of-OpenResty.pdfThe Past, Present, and Future of OpenResty OpenResty

The