Recently I have been conducting some write tests based on SSD hard drives. The background is as follows: I developed a simple file upload server using the Go language. The key code is as follows:
for each uploaded file, a UUID is generated as its ID. To ensure that there are not too many files in a directory, I use the first two characters of the UUID as the first-level directory, and the next two characters as the second-level directory. The file name inside the second-level directory is the UUID itself, and the size generally does not exceed 500MB, usually 10MB. By printing the time spent at each step, I found that the IO.copy takes the most time, reaching up to several tens of seconds at most, but at this time, the system is not under much pressure. By tracking with blktrace, I found that the MAX indicator of the Q2G item is very large. I would appreciate it if any expert could help me take a look at what the problem is. Thank you very much.
for each uploaded file, a UUID is generated as its ID. To ensure that there are not too many files in a directory, I use the first two characters of the UUID as the first-level directory, and the next two characters as the second-level directory. The file name inside the second-level directory is the UUID itself, and the size generally does not exceed 500MB, usually 10MB. By printing the time spent at each step, I found that the IO.copy takes the most time, reaching up to several tens of seconds at most, but at this time, the system is not under much pressure. By tracking with blktrace, I found that the MAX indicator of the Q2G item is very large. I would appreciate it if any expert could help me take a look at what the problem is. Thank you very much.