简体   繁体   中英

No-delay persist data between application restarts

I'm re-writing performance critical function in my application, and I need a good way to store record id.

Before that, I was storing the id to file, for that I had to lock file, write data and than flush it. This takes too long.

Are there any better ways to persist the record id?

It seems very unlikely that You would be bumping the HDD speed limit in this case. But if You are - Your best option is to change the HDD to SSD, or even further - change it to a RAID SDD array - so that it would write in parallel.

If the problem is in Your c# code - well there are a couple of solutions (exploring write speeds)

How to write super-fast file-streaming code in C#?

Performance of Writing to File C#

Also - You may consider using async/await , to allow Your code to continue executing while the disk is processing Your Write request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM