tags:

views:

532

answers:

3

i currently have an application that sends XML over TCP sockets from windows client to windows server.

we are rewriting the architecture and our servers are going to be in Java. one architecture we are looking at is a REST architecture over http. so csharp winform clients will send info using this. We are looking for high throughput and low latency.

Does anyone have any performance metrics on this approach versus some other csharp client to java server communication options.

+4  A: 

This isn't really well-enough defined to make any metric statements; how big are the messages, how often would you be hitting the REST service, is it straight HTTP or do you need to secure it with SSL? In other words, what can you tell us about the workload parameters?

(I say this over and over again on performance questions: unless you can tell me something about the workload, I can't -- nobody really can -- tell you what will give better performance. That's why they used to say you couldn't consider performance until you had an implementation: it's not that you can't think about performance, it's that people often couldn't or at least wouldn't think about workload.)

That said, though, you can make some good estimates simply by looking at how many messages you want to exchange, because setup time for TCP/IP often dominates REST. REST offers two advantages here: first, the TCP/IP time often does dominate the message transmission, and that's pretty well optimized in production web servers like Apache or lighttpd; second, a RESTful architecture enhances scalability by eliminating session state. That means you can scale freely using just a simple TCP/IP load balancer.

Charlie Martin
You can also optimise the client, e.g. by ensuring TCP connections remain open across multiple requests. You should also ensure you add ETags or similar headers for cache validation - it'll give you better cache performance and freshness than simple rolling expiry dates. But don't optimise early!
Simon Gibbs
A: 

I would set up a test to try it and see. I understand that the only part of your application you're changing is the client/server communication. So analyse what you're sending now, and put together a test client/server setup sending messages which are representative of what you think your final solution is going to be doing (perhaps representative only in terms of size/throughput).

As noted in the previous post, there's not enough detail to really judge what the performance is going to be like. e.g.

  1. is your message structure/format going to be the same, but merely over HTTP rather than raw sockets ?
  2. are you going to be sending subsets of XML data ? Processing large quantities of XML can be memory intensive (e.g. if you're using DOM-based approach).
  3. What overhead is your chosen REST framework going to be introducing (hopefully very little, but at the moment we don't know).

The best solution is to set something up using (say) Jersey and spend some time testing various scenarios. If you're re-architecting a solution, it's going to be worth a few days investigating performance (let alone functionality, ease of development etc.)

Brian Agnew
A: 

It's going to be plenty fast, unless you have a very, very large number of concurrent clients hitting those servers. The XML shredding keeps getting faster in both Java and .NET. If you are on CLR2 and Java 5 or above, you will be fine. But of course you still need to do the tests to verify.

We've tested in our lab, REST and SOAP transactions, and they are faster than you might think. Tens of thousands of messages per second. Small numbers of modern CPUs generating XML messages can easily saturate a gigabit network. In other words, the network is the bottleneck (transmission of data), not the CPU (serializing & de-serializing XML).

AND, If you do your software design properly, in the very unlikely situation where REST is not sufficient, then swapping out the message format layer (REST => protobufs) will get you better transmission perf, with minimal disruption.

But before you need to go there, you will be able to send some money to Cisco and get lots more headroom.

Cheeso