Skip to content

Connections and Sessions

Raphaël Valyi edited this page Mar 30, 2014 · 11 revisions

Considerations about transport protocols and performance

Traditionally OpenERP clients have been using XML/RPC as a transport protocol. But since OpenERP v7 and the supremacy of the OpenERP web-client, OpenERP got a very good JSON-RPC 2 transport layer to support the Ajax requests of its web-client.

Since then, Ooor 2.x has been taking advantage of this JSON-RPC 2 protocol, using the Ruby Faraday gem (same plugable architecture as Rack). Using JSON has proved to be 10x faster than XML-RPC! Hence Ooor 2.x is 10x faster than Ooor 1.x when the speed isn't bound to OpenERP itself. This also enabled us to deprecate the jooor gem acceleration layer used on JRuby, for instance in Terminatooor to get better performance using a Java XML/RPC implementation. the JSON gem is optimized in JRuby out of the box and performance is great better on JRuby seamlessly now.

The Connection concept

So basically Ooor uses a connection to OpenERP and that connection is using JSON as the transport layer on OpenERP v7+ and falls back to XML/RPC on OpenERP 6.1. For most of the webservices, a connection is bound to:

  • an OpenERP server URL
  • a database
  • a user credential (login/password)

The Session concept

But OpenERP v8 pushed the web layer further: OpenERP v8 has been extending the usage of HTTP sessions. Specifically, in OpenERP v8, it's really supported use case that 2 different users use the same OpenERP connections but a different session! This typically happens when 2 anonymous users Alice and Bob use OpenERP e-commerce and each have their own shopping cart and place their own anonymous orders eventually.

This is a very great advance in OpenERP but forced use to review Ooor architecture extensively in Ooor 2.x. Basically we couldn't consider that say a SaleOrder proxy was exactly the same proxy for Alice and Bob anonymous users. We had to keep track that Alice and Bob were in fact using different sessions and forward that information to OpenERP properly so that when Alice requests its list of anonymous sale orders she won't see the Bob's orders.