I'm building a small web server for learning purposes.
For each incoming POST request I'm planning to append the content to a file.
I'm开发者_C百科 using ZeroMQ sockets for communicating with the file-append process. Do I need to take special care with the file operations (fopen, fseek)?
Considering a typical Amazon EC2 instance and that each request has at most 1kb, how many file-append operations per second can my server handle?
Thanks!
Basic concerns should be followed, what happens if multiple processes are run and receive messages. What happens if you run out of disk space or a write fails?
Are you after synchronous writing to disk or is buffered, and potential of log corruption, acceptable? fopen
and friends are buffered, consider open
and friends for non-buffered writes.
Performance is tied to whether you can batch writes, use buffering, or want synchronous writes to disk. I think Amazon provide some IOPS details, certainly other developers have published results:
http://www.thebitsource.com/featured-posts/rackspace-cloud-servers-versus-amazon-ec2-performance-analysis/
http://blog.dt.org/index.php/2010/06/amazon-ec2-io-performance-local-emphemeral-disks-vs-raid0-striped-ebs-volumes/
https://forums.aws.amazon.com/thread.jspa?messageID=132387
精彩评论