0

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?

Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
  • Send a message to a queue and let it do the work? – Crowcoder Mar 11 '16 at 12:40
  • Yep, queue is able to process ~2000msg per second, so if that is NOT fast enough, then there's a question if You need to search, sort data or NOT ? Do You need SQL for this ? do you need transaction support for this ? – Marty Mar 11 '16 at 12:44

1 Answers1

1

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.

Community
  • 1
  • 1
Marty
  • 3,485
  • 8
  • 38
  • 69