i have , android app sends live data php server. data in json format , sent in http post request android app php. data sent large, tune of 11kb. need send 11 kb of such information every 2 seconds 1 week. has led 2 problems:
- the data large , sent on cellular network. hence, turning out quite expensive operation.
- it taking long time transfer 11 kb of information app server. delaying subsequent post requests, thereby making entire data transfer very slow.
we have considered using web sockets , protocol buffers alternatives. problem these options need change entire structure of our code.
are there other options in reducing data (like compressing significantly) data transfer on cellular network consume less space , can done faster? have read gson, bson etc. not convinced efficiency on current json structure.
it possible compress post data using http protocol:
depending on http client using, have compress content yourself. quite done gzipoutputstream provided jdk 7.
on client-side need provide following http request headers:
content-encoding: gzip
content-length: x
, x size in bytes of entity body after compression.
the data has decoded on server, done using mod_deflate.
however, not think compression much. transferring 11 kb of information on cellular network not take longer transferring 11 bytes of information. ping (and http protocol) problem.
i'd suggest using persistent http connection, might improve transfer times keeping connection open.
but definitely better of using web-sockets , binary serialization. web-sockets use persistent connection less overhead, results in low latency connection.
Comments
Post a Comment