web事务模式下的数据库连接的占用时间

4 views
Skip to first unread message

Chunlin Zhang

unread,
Mar 18, 2016, 3:43:11 AM3/18/16
to uli...@googlegroups.com
在用web事务模式,CONNECTION_TYPE = 'long' 的情况下,什么时候占用一个数据库连接,什么时候可以释放连接被其他的请求处理使用呢?

我今天用ab做了一些数据库相关的压测,在考虑这个问题,不知道有没有优化空间,比如尽量少得占用数据库连接,尽早释放,不知道有没有改善的空间

limodou

unread,
Mar 19, 2016, 3:39:35 AM3/19/16
to uliweb
uliweb支持短连接,一个请求一个连接。

长连接是用在uwsgi上,一般一个进程或gevent的一个线程要占一个连接,不过Sqlalchemy一般有连接池,可能会多一些。不过在mysql中使用show
processlist好象并不多。

On Fri, Mar 18, 2016 at 3:43 PM, Chunlin Zhang <zhangc...@gmail.com> wrote:
> 在用web事务模式,CONNECTION_TYPE = 'long' 的情况下,什么时候占用一个数据库连接,什么时候可以释放连接被其他的请求处理使用呢?
>
> 我今天用ab做了一些数据库相关的压测,在考虑这个问题,不知道有没有优化空间,比如尽量少得占用数据库连接,尽早释放,不知道有没有改善的空间
>
> --
> -- ----
> Project : https://github.com/limodou/uliweb
> doc : http://limodou.github.com/uliweb-doc
> ---
> You received this message because you are subscribed to the Google Groups
> "Uliweb" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to uliweb+un...@googlegroups.com.
> To post to this group, send email to uli...@googlegroups.com.
> Visit this group at https://groups.google.com/group/uliweb.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/uliweb/CAG2rzA%3D-kSCNuu1VeYkt5%2BcZidBfE%2BqNeZLC_Lp6KfhPkS0ytw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
I like python!
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
UliWeb <<simple web framework>>: https://github.com/limodou/uliweb
My Blog: http://my.oschina.net/limodou

Chunlin Zhang

unread,
Mar 19, 2016, 7:53:01 AM3/19/16
to uli...@googlegroups.com
短连接是不是不利于高并发?因为数据库连接没有重复被利用?

limodou

unread,
Mar 19, 2016, 9:53:19 AM3/19/16
to uliweb
Reply all
Reply to author
Forward
0 new messages