I am currently designing system which should allow access to database. Assumptions are as follows:
- Database should has access layer. The access layer should provide objects that represents database tables. (This would be done using some ORM framework).
- Client which want to get data from database, should get object from access layer first, and then get data using those objects.
- Clients could use Python, Java or C++.
- Access layer is based on Java.
- There won't be to many clients, but they will be opearating on large amounts of data.
The question which is hard for me is what technology should be used for passing object between acces layer and clients. I consider using ZeroC ICE, Apache Thrift or Google Protocol Buffers. Does anyone have opinion which one is worth using?
This is my research for Protocol Buffers:
Advantages:
- simple to use and easy to start
- well documented
- highly optimized
- defining object data structure in java-like language
- automatically generating implementation of setters and getters and build methods for Python, Java and C++
- open-source bidnings for other languages
- object could be extended without affecting old version of an applications
- there are many of open-source RpcChanel and RpcController implementation (not tested)
Disadvantages:
- need to implement object transfer
- objects structure have to be defined before use,
so we can't add some fields on the fly(Updated: there are posibilities to do that, see the comments) - if there is a need for reading one object's filed, we have to parse whole file (in contrast, in XML we could ignore chosen tags)
- if we want to use RPC for invoke object methods, we need to define services and deliver RpcChanel and RpcController implementation
This is my research for Apache Thrift:
Advantages:
- provide compiler that generates source code for supported languages (classes, all things that are important)
- allow defining optional fields in the structures ( when we do not set value on a field, the size of transfered data is lower)
- enable point out some methods that are "one way" (returning nothing and client after invokation do not wait for answer from server about completion processing of query)
- support collections (maps, lists, sets), objects, primitives serialization (deserialization), constants, enumerations, exceptions
- most of problems, errors are solved and explained
- provide different methods of serialization: (TBinaryProtocol...) and different ways of exchanging data: (TBufferedTransport, TZlibTransport... )
- compiler produces classes (structures) for languages thaw we can extend by adding some new methods.
- possible to add fields to protocol(server as well as client) and remove other- old code and new one can properly interact(some rules in update)
- enable asynchronous calls
- easy to use
Disadvantages:
- documentation - contains some errors that sometimes it is really hard to get to know what is the source of the problem
- not allways problems are well taged (when we look for solution in the Internet).
- not support overloading for service methods
- tutorials cover only simple examples of thrift usage
- hard to start
ICE ZeroC: Is better than Protocol Buffers, because I wouldn't need to implement object passing by myself via e.g. sockets. ICE also gives ServantLocators which can provide management of connections. The question is: whether ICE is much slower and less efficient than the PB?