最近实现了一个http的接口 ~ http的方式,访问结果为json
nginx做负载,web分离,url转发 ~
tornado做数据操作和异步调用lua的接口 ~
memcached做session的共享 (为啥不用redis做session,一方面是为了不和redis有kv冲突,服务器的中断冗余,更主要的方面是用redis存储session我没有做出来,郁闷呀。。。。)
redis做kv数据库和队列系统
后端的nginx lua是mysql的http方式的json展现接口
nginx 的配置大家都懂的,就是利用upstream负载。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
worker_processes 4 ;
error_log / var /log/nginx/error.log;
pid / var /run/nginx.pid;
events {
worker_connections 30000 ;
useepoll;
}
http {
charset utf- 8 ;
# Enumerate all the Tornado servers here
upstream frontends {
server 127.0 . 0.1 : 8000 ;
server 127.0 . 0.1 : 8001 ;
server 127.0 . 0.1 : 8002 ;
server 127.0 . 0.1 : 8003 ;
}
include /path/to/nginx.mime.types;
default_type application/octet-stream;
access_log / var /log/nginx/access.log;
keepalive_timeout 65 ;
proxy_read_timeout 200 ;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
gzip on;
gzip_min_length 1000 ;
gzip_proxied any;
gzip_types text/plain text/css text/xml
application/x-javascript application/xml
application/atom+xml text/javascript;
# Only retry ifthere was a communication error, not a timeout
# on the Tornado server (to avoid propagating "queries of death"
# to all frontends)
proxy_next_upstream error;
server {
listen 80 ;
|
请发表评论