Comments (12)
(1) 是的,这是最佳实践
(2) gunicorn_thrift 目前不支持 TFramedTransport,推荐使用 TBufferedTransport
(3) 可以使用 Redis, ETCD, Zookeeper 等其它工具实现锁
微信:394519475
from gunicorn_thrift.
(1) 是的,这是最佳实践
(2) gunicorn_thrift 目前不支持 TFramedTransport,推荐使用 TBufferedTransport
(3) 可以使用 Redis, ETCD, Zookeeper 等其它工具实现锁微信:394519475
@ethe 非常感谢你的replay. 收益匪浅!
对于第(3)点,使用redis 实现 多worker进程之间的同步锁,是否会大幅降低gunicorn_thrift处理并发的性能了? 毕竟多了频繁的redis网络交互?
是否可以想办法使用mutilprocess.Lock 原生lock来实现gunicorn_thrift pre_fork 出的多个work子进程共享这个lock对象,实现同步了? 我试了一哈,在app.py里,定义一个如下的全局进程锁,然后在app业务handler里去用该进程锁对象互斥,是不生效的? 不知@ethe有没有更好的建议。
我的示例代码如下app.py:
from gunicorn_thrift.
你要在跨进程间用锁性能就好不了。mutilprocess 基本只能做单机。
from gunicorn_thrift.
你要在跨进程间用锁性能就好不了。mutilprocess 基本只能做单机。
就是单机的, 我在单机上 用gunicorn_thrift启动一个thriftpy2 server实例, 开启多个worker进程,一个实例的多个worker进程之间,在处理业务handler里部分操作需要同步。 并不需要跨主机(或者跨server实例)
@ethe 有什么好的建议么? 我尝试在app.py 里定义一个全局的mutilprocess.Lock()对象,然后在handler里处理请求是使用这个锁同步,实际测试结果,不生效,并不能同步, 对于一个全局计数器累加,仍有脏数据。
from gunicorn_thrift.
这不属于 gunicorn_thrift 的本身的问题,所以抱歉我无法回答。
from gunicorn_thrift.
@wooparadog @ethe 请问 这个PR 实现的gthread worker 我看就差Manual test了, 首先跟二位大神确认一哈, gthread worker使用起来支持 transport = tframedtransport么? 还是仍只支持tbufferdtrasport?
#61
我可以在我们实际的各个业务线线下测试场景应用gthread worker 进行实践测试
@wooparadog @ethe 最近在大规模应用gunicorn + thriftpy2 做性能优化,疑问较多,还望见谅!
from gunicorn_thrift.
看了一下源码,似乎没有不允许使用 TFramedTransport 的限制。我们在生产环境下使用的多进程 + Gevent + TBufferedTransport,可供参考。
from gunicorn_thrift.
看了一下源码,似乎没有不允许使用 TFramedTransport 的限制。我们在生产环境下使用的多进程 + Gevent + TBufferedTransport,可供参考。
@ethe @wooparadog 我们的某些业务场景必须使用Tframedtransport, 所以能否烦请 @wooparadog 帮确认,gthread worker 是否支持transport为Tframedtransport类型?
多谢, 多谢!
from gunicorn_thrift.
@ethe 你好! 我今天在使用gunicorn_thrift启动我的thriftpy2服务时, 想给app传递一些可变参数,我看gunicorn官方是支持package:build_app(a=1,b=2)这种方式去生成app的,如下:
https://stackoverflow.com/questions/8495367/using-additional-command-line-arguments-with-gunicorn
但是gunicorn_thrift看上去不支持这种方式生成app, 如下:
from gunicorn_thrift.
@victordudu1121 gunicorn_thrift 应该是不支持工厂模式的调用方式,gunicorn 在 20.0 的版本也不兼容这种启动方式,详见:benoitc/gunicorn#2159
另外 @ethe 是否 load_obj 函数应该和 gunicorn 保持一致的行为,直接引用?https://github.com/benoitc/gunicorn/blob/master/gunicorn/util.py#L323
from gunicorn_thrift.
我没有找到 load_object 的部分。。上面那种工厂模式的方式 gunicorn 似乎也不支持,参数的部分应该可以有 walk around 的办法吧,比如环境变量什么的。
from gunicorn_thrift.
嗯, 我们其实没有想完全追上上游的 feature 的. 工厂方法也有很多其他的方法实现. 就不在这个库里面加了.
from gunicorn_thrift.
Related Issues (20)
- Is it right always log a full stack exception? HOT 3
- Gevent support in Python 3 HOT 2
- Problem about running gunicorn_thrift HOT 3
- gunicorn_thrift block problem with high concurrency HOT 5
- Implement gthread worker HOT 1
- The gunicorn got timeout but not exit HOT 1
- Could not open eleme/gunicorn any more HOT 3
- Update pypi distribution HOT 2
- in the pressure test,cpu usage suddenly fall for a moment,it leads to that requests were time out HOT 2
- when i use gunicorn_thrift to start thriftpy2 app, one worker just can accept one client connection HOT 1
- 关于SO_REUSEPORT的问题 HOT 9
- 线上偶现请求时间过长问题 HOT 2
- Issue of gunicorn version HOT 3
- Configure worker number HOT 2
- Is this repo alive? HOT 11
- gunicorn_thrift with http query HOT 3
- 没有及时回收socket HOT 4
- [gunicorn compatibility issue] ImportError: cannot import name 'six' from 'gunicorn' HOT 2
- can I set not default proto_factory to handle the request?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gunicorn_thrift.