0

I'm using json-rpc-cpp library from cinemast

As a test I have written simple server which takes two integers and returns their sum to the client. On a really small VPS (128 MB RAM) it was possible to reach ~270 queries per second on localhost and then on two separate VPS's.

Is such a result standard for json-rpc? Can I make it noticeably faster?

user2461440
  • 182
  • 1
  • 11
  • 1
    I suspect the vast majority of that is the time it takes for a packet to traverse the network and back again. Adding two numbers is a very tiny operation in the whole scheme of things. You could prove that by sending a couple of arrays of 100 integers each, and return the sum of those arrays as an array, and I would expect you get close to the same performance. – Mats Petersson Jun 08 '13 at 20:42
  • @MatsPetersson: I would say its more the overhead of packet creation and parsing that builds up for the time, the network packet travelling from one userspace to the other is usually only in the area of microseconds, if at all. – PlasmaHH Jun 08 '13 at 20:50
  • So "localhost" is not a different machine than the "VPS"? – Mats Petersson Jun 08 '13 at 20:53
  • Yes. I mean the test on one machine gives pretty the same result as on two different via internet – user2461440 Jun 08 '13 at 20:59
  • Well, I tested it on my 5 years old laptop and it can handle ~2500 queries per second and the lack of system time was the limit, so the library is pretty fast – user2461440 Jun 09 '13 at 09:21

1 Answers1

1

I would say no, that your results do not seem typical. And yes, you should be able to make it faster.

I know this link is not c++ and the box I tested on had more resources then your VM, but I can get 100k-120k per second using http://jsonrpc2.codeplex.com/

I would expect your purely native code to perform similarly.

Austin Harris
  • 1,676
  • 1
  • 17
  • 22