pchalamet / cassandra-sharp

high performance .NET driver for Apache Cassandra
114 stars 41 forks source link

Performance Improvement #62

Closed axle-h closed 11 years ago

axle-h commented 11 years ago

Currently, using the POCO interface ReadByteArray() is called on SocketReadOnlyStream for every column and every row of the results of a query. In my case that's 4.2m times for a typical query. This seems to hammer the CPU. Probably because of all the Windows socket API calls? The only solution I can see is to buffer each frame body into a memory stream. I've forked and stripped your driver right down and just by implementing buffered frames, see ~50% better performance for large queries. Maybe in cassandra-sharp a BufferingFrameReader could work? Such an implementation could provide an easier way of supporting compressed frames also.

pchalamet commented 11 years ago

Yes this uses to exist in previous version... Buffering should be done, I do agree. Go on then !

-----Original Message----- From: "Alex Haslehurst" notifications@github.com Sent: ‎10/‎07/‎2013 11:35 To: "pchalamet/cassandra-sharp" cassandra-sharp@noreply.github.com Subject: [cassandra-sharp] Performance Improvement (#62)

Currently, using the POCO interface ReadByteArray() is called on SocketReadOnlyStream for every column and every row of the results of a query. In my case that's 4.2m times for a typical query. This seems to hammer the CPU. Probably because of all the Windows socket API calls? The only solution I can see is to buffer each frame body into a memory stream. I've forked and stripped your driver right down and just by implementing buffered frames, see ~50% better performance for large queries. Maybe in cassandra-sharp a BufferingFrameReader could work? Such an implementation could provide an easier way of supporting compressed frames also. — Reply to this email directly or view it on GitHub.

axle-h commented 11 years ago

OK, happy to help but not a lot of time currently. I'll get something together over the next week.

Alex

pchalamet commented 11 years ago

I had some time this afternoon and fixed this since it is trivial.

Read buffering is now on by default and can be disabled using TransportConfig.ReceiveBuffering (old mode).

Cheers,

From: Alex Haslehurst [mailto:notifications@github.com] Sent: Wednesday, July 10, 2013 12:56 PM To: pchalamet/cassandra-sharp Cc: Pierre Chalamet Subject: Re: [cassandra-sharp] Performance Improvement (#62)

OK, happy to help but not a lot of time currently. I'll get something together over the next week.

Alex

— Reply to this email directly or view it on GitHub https://github.com/pchalamet/cassandra-sharp/issues/62#issuecomment-20734752 . https://github.com/notifications/beacon/_W-KgiNRE22l2TYlJFJ2rAVLZu81KNCzgBJSbLYwkvF6xtd1Qo17nkpKLZIkSbIy.gif

axle-h commented 11 years ago

Looks good thanks.