.net - Reading from DB and Writing to File -
.net - Reading from DB and Writing to File -
scenario - there huge info in database. utility uses datareader read records 1 1 , appends txt/xml file. utility used read 1 record, write file; changed around 10k records read , set memory (stringbuilder) , flushed file , on. time reduction superb.
so, guess file i/o bottleneck. want improve further. thinking utilize kind of buffer, , utilize 1 thread read db , set buffer, , thread fetch buffer , write file.
is possible. start? improve alternatives?
a starting point using 2 buffers, , asynchronously writing buffer content file. like:
buffera bufferb currentbuffer=buffera fill currentbuffer info kickoff job write currentbuffer file wait previous write job finish, if relevant. currentbuffer=otherbuffer
repeat until complete.
.net asp.net visual-studio file-io
Comments
Post a Comment