Will there be some response?
Oshyn Song <dualyangsong(a)gmail.com> 于2019年10月19日周六 下午1:08写道:
There is requirement connecting to RADOS cluster by
Golang, and the
sub-project
go-ceph(https://github.com/ceph/go-ceph) is the first
solution. It uses cgo linking the librados library and works OK. I used
go-ceph in one project, there are some problems annoying me:
1. The connection created to the RADOS cluster must be closed
explicitly, because golang runtime GC does not care about it. If your
application holds a global connection and does not close, it will be a
waste of resource of the RADOS cluster. Otherwise, you need to implement a
connection pool for management, which increases complexity and needs a
strong testing.
2. librados is implemented with C/C++ and pthread thread model, and it
heavily depends on the low-level messenger implementation. What I used in
my project is the luminous version, and it will create 14 new threads when
creating a connection to the RADOS cluster(use pstack on centos7). So the
mixed threads used by the golang runtime and librados causes the problem
here <https://tracker.ceph.com/projects/ceph/wiki/Here>(
https://stackoverflow.com/questions/47466139/there-are-many-threads-reserve…
).
3. The golang program must depend on the librados when compiling and
running, it decreases the maintainability compared with common static-built
golang program.
There are also some problems if you use go-ceph in your golang project,
such as the messenger layer is not efficient as golang. There is every
reason to implement the gorados - pure go client to connect RADOS cluster -
to make ceph as a backend storage in production-level golang project
directly. I make this idea as a fact, and provide the draft startup on
github:
https://github.com/oshynsong/gorados. It implements the cephx
protocol to connect the monitor, and needs more development. Welcome to
join me and I hope gorados as a sub-project of ceph!
--
Oshyn Song
Software Engineer of Distributed Storage , Baidu.Inc, Beijing, China
Sincerely!
--
Shuangyang Song(Oshyn Song)
Class 20140707, School of Computer and Control, UCAS
Tel:(+86)13241375819
Sincerely!