Ayende @ Rahien

Hi!
My name is Ayende Rahien
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

@

Posts: 5,947 | Comments: 44,540

filter by tags archive

Didja know, RavenDB include a proxy server


This is one of those things that I had to read several times to realize what was actually going on.

The code for that is here: https://github.com/ayende/ravendb/blob/c0c9ccf98011fb64b5eb5406a900ec1338ea78e4/Raven.Tests/Issues/RavenDB_1603.cs#L32

And it appears that along with every else, RavenDB also include a proxy server.

Now, to be fair, this is required for our tests, to see what happens when we have a forced disconnect / timeout at the network level, so it make sense. And the whole thing is under 100 lines of code.

This sort of thing explains why we really need to do a whole bunch of work on our tests. We want to get to a 500 – 1000 tests (currently we have close to 3,200) that run in under 5 minutes.


Comments

Rafal

Nice proxy, and some clever use of async I yet have to get used to. But for a beginning, what's the difference between

var read = await incomingStream.ReadAsync(buffer, 0, 4096, token);

and

var read = incomingStream.Read(buffer, 0, 4096)

is the first one any better?

Andy Pook

It looks like there are a couple of "bugs". Two of the while(true) loops look like will never exit (except on exception). In Forward it should probably use "!cancellationTokenSource.IsCancellationRequested" In the writeTask it should probably "break" when "read == 0" as the readTask does. An "extract method" refactoring would help.

Without these I think there's a task leak. Though as this is "just test code" it's safe enough :)

Ayende Rahien

Rafal, The first one is better because it will yield the thread for the duration of the actual IO, leaving it free to do other work.

Remco

Just because I spent 5 minutes looking for why line 62 was there... It seems this cancellation token is never used...

https://github.com/ayende/ravendb/blob/c0c9ccf98011fb64b5eb5406a900ec1338ea78e4/Raven.Tests/Issues/RavenDB_1603.cs#L62

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

No future posts left, oh my!

RECENT SERIES

  1. RavenDB Sharding (2):
    21 May 2015 - Adding a new shard to an existing cluster, the easy way
  2. The RavenDB Comic Strip (2):
    20 May 2015 - Part II – a team in trouble!
  3. Challenge (45):
    28 Apr 2015 - What is the meaning of this change?
  4. Interview question (2):
    30 Mar 2015 - fix the index
  5. Excerpts from the RavenDB Performance team report (20):
    20 Feb 2015 - Optimizing Compare – The circle of life (a post-mortem)
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats