Open fbonecco-cribl opened 2 years ago
I understood right away the issue, but finding a different way to approach the change required me to carve out some time to get familiar with Golang's api for File seek and read.
The read time is now constant. Reading 100 lines from either a 1, 2 or 14 GB file is ~40µs. Reading 100k records from the 14GB file is less than 10ms.
I suspect this change should address the concerns and fulfill the requirements.
Hey @skormos - This is Franco from Cribl. First of all, thanks again for taking the time to complete the assignment.
I've been looking at your code and running different test scenarios. I noticed some sort of performance degradation as the requested file size grows. I'm using
numEntries=10
, on files of different sizes, to get the last 10 log entries. Here're are the results I've got for comparison:File 1 - 100-lines.log - 12K
File 2 - 2M.log - 173M
File 3 - logfile.log - 22G
While File 1 and File 2 didn't present any noticeable difference, File 3 took way longer to complete. Since I was just requesting the last 10 entries, I'd have expected all these 3 calls to take roughly the same amount of time (which should be a few ms), no matter what the requested file size was. Agree?
Can you please try to find what's causing this perf degradation and address the problem?
Let me know if you have any questions!