1

I have to create a proxy for file uploading but the problem is that I don't have to store an entire file on the proxy server. My proxy have to accept very big files (files with size up to 80 GB) and store an entire file in the object storage (openstack swift). But proxy don't have to keep an entire file in the RAM or on the disk. Proxy have to act like a pipe.
How to create such system?

1 Answer 1

2

Simple create a server socket to accept the requests and for each request received, open an output stream to the target (filesystem, database, cloud storage, ...). Then do a loop which reads a chuck of bytes, e.g. 4K bytes, from the input stream and then write those 4K bytes to the output stream. Continue this, until there are no more bytes to read from the input. Close the input stream and flush and close the output stream. See here for an example

Connecting an input stream to an outputstream

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.