I have written a very simple webserver in Scala (based on Actors). The purpose of it so to log events from our frontend server (such as if a user clicks a button or a page is loaded). The file will need to be rotated every 64-100mb or so and it will be send to s3 for later analysis with Hadoop. the amount of traffic will be about 50-100 calls/s
Some questions that pops into my mind:
- How do I make sure that all actors can write to one file in a thread safe way?
- What is the best way to rotate the file after X amount of mb. Should I do this in my code or from the filesystem (if I do it from the filesystem, how do I then verify that the file isn't in the middle of a write or that the buffer is flushed)