java - Most performant protocol for uploading binary data to a jax-rs (REST) service -
environment
my application (war) has javascript frontend , java rest service.
the files uploaded generated in frontend, not directly user interaction -- not use case user uploading files herself. reason, it's necessary initiate upload javascript code.
i need able send metadata (generated other parts of application) binary data when i'm uploading -- why need sort of protocol instead of uploading file.
question
what haven't been able determine best practice uploading files, regards, primarily, protocol used.
i've come across following protocols:
- json
- xml
- proctol-buffers (via protobuf.js)
however, internets has, usual, lots of different info hasn't been giving me coherent picture:
- with regards reliability, internets seems you're better off using
multipart/mixedtype transfer data, instead of pureapplication/octet-streamtype. - json doesn't natively doesn't support binary data, , apparently, base64 has high processing overhead.
- it's javascript frontend, json preferred.
- sure, use protobuf.js, i'd rather use leading-edge tech bleeding-edge tech.
my priorities are:
- reliable data transfer of files between 1 , 10 megabytes.
- performant , efficient data transfer.
- readable code/architecture
in short, which of 3 formats mentioned above fits requirements best, given i'm using java rest service on backend?
(if fact i'm using java rest service -- instead of say, servlet -- upload files going biggest slowdown, that's answer!)
edit: added information asked comments -- thanks!
Comments
Post a Comment