开发者

Performance for reading files and inserting contents into database

开发者 https://www.devze.com 2023-03-04 21:16 出处:网络
I\'m developing a system that is开发者_如何学JAVAn\'t real time but there\'s an intervening standalone server between the end user machines and the database. The idea is that instead of burdening the

I'm developing a system that is开发者_如何学JAVAn't real time but there's an intervening standalone server between the end user machines and the database. The idea is that instead of burdening the database server every time a user sends something up, a windows service on the database machine sweeps the relay server at regular intervals and updates the database, deleting the temporary files on the relay box.

There is a scenario where the client software installed on thousands of machines sends up information at nearly the same time. The following hold true:

  • The above scenario won't occur often but could occur once every other week.
  • For each machine, 24 bytes of data (4k on the disk) is written on the relay server, which we want to then pick up and update the database with. So although it's fine if the user base is only a few thousands for now, they may amount to millions overtime.

I was thinking of a batch operation that only picks up some 15,000 - 20,000 files at a time and runs every whenever (amendable from app.config). The problem is that if the user base grows to a few million that will take days to complete. Yes, it doesn't have to be real-time information but waiting for days for all the data to reach the database isn't ideal either.

I think there will always be a bottleneck if the relay box is hammered, but are there better ways to improve performance and get the data across at a reasonable time (a day, two tops)?

Regards, F.


I think you might consider that to avoid hammering the disk only one thread reads the files and then hands off processing to multiple threads to write to the database and returns to the disk thread to delete the files after commit. The amount of DB threads could be "amendable from app.config" to find the best value for your hardware config.

Just my 2 cents to get you thinking.

0

精彩评论

暂无评论...
验证码 换一张
取 消