Jacob Phillips
Jacob Phillips

Reputation: 9264

REST client throughput in Android

I have a project going where several devices submit data to a central server on the local network using a REST service. I am trying to determine how complex of a client I need in Android. Each device will be generating data quickly (i.e. sensor data), so its client will send frequent requests but can also bundle data into larger, less frequent ones. I'd estimate the throughput per client at about 50KB per second.

Is a REST client an appropriate strategy? How much data would be too much? Any thoughts on this would be appreciated.

Even if it is advisable, there are several options to choose from such as

I do have my own implementation from a couple years ago that uses HttpClient, but it's probably outdated.

Upvotes: 1

Views: 97

Answers (2)

sschrass
sschrass

Reputation: 7166

It greatly depends on your exact needs, but

you also could just send a list of sensorDatas every 10minutes for instance (numbers figured), as you mentioned before. Sending those collections has the charm that the client could determine when the collection has to be sent, like every 10min or every 10 entries, or before the device goes into stanby/onPause etc.

On serverside there must be a way of putting/posting collections created by the client. Depending on your needs the collection then could be seperated into single resources on the server. The clientside implementation should not be far from posting single sensorData. It's just bundeling and sending.

Socket communication on the other hand renders your RESTful Service pretty useless.

Because I got the impression, that the process isn't that complex, I would go for an own implementation using HttpClient AND I would read about the different HttpClients beforehand. (There is an apache one, and a fork of it rolling with the Android SDK. I am currently unaware of if this gets you in trouble later).

Upvotes: 1

Simulant
Simulant

Reputation: 20112

Because you are constantly sending data, I would prefere to create a Socket communication. With REST you would need to send a new POST for every chunk of data including the http overhead. The Socket communication will be keept alive and the overhead should be less.

Upvotes: 0

Related Questions