Friday 28 April 2017

Document DB discovery

DocDB is ideal for fast appends and reads, but not so good on updates.

(I also found a few weeks ago when if a document is revised several times the change feed will only ever point at the most recent version and not the historical versions! Luckily our Event Store is an append-only store so this is not a problem).


When a document is updated the whole document is replaced as the record is immutable. Fields are not updated in-place. MS recommend if you have large documents doing high volume updates then you break the document down into the immutable section and the updated section. Or if you have high-volume updates have smaller documents. Reduce the indexing.

The fastest and cheapest way to access a document is by its ID rather than querying. The exception is when you don’t know whether you have it – and you do this frequently. In this scenario a missing document results in a 404 Not Found and an SDK exception which is costly to the calling client’s CPU. Frequent 404s will result in reduced client throughput.

The .NET core SDK differs from .NET standard in that it cannot support the Direct TCP mode (for interoperability). You are forced to use HTTP connections and thus it may be 1ms slower in normal use cases compared to direct [and self-managed] TCP connections.


Expensive operations such as querying for a document and not specifying a partition key can result in a fanout operation. The SDK will normally prevent this but you can specify a parameter to override it.

Document DB RU throttling

DocumentDB allows the partition go into debt but will throttle any subsequent requests.

If the collection is configured with 100 RU/sec allocated per partition. If a write requires 101 RU’s, then the remaining balance will be -1 RU for the remainder of the second. Any requests during the remainder of the second will be asked to retry in 1 second – when the RU balance will come back up to 99 RU’s.


A burst feature may be provided in the future that allows you to overuse your RU allocation, but it will go into a special pricing tier for that period.

Looking into DocumentDB

With the release of the DocumentDB emulator it is possible to dig deeper into the magic that is hidden behind the PaaS offering.

It is a native-code guest executable running in a Service Fabric context
It is deployed as 5 services to Fabric
  • DataExplorer
  • DataExplorerUpdater
  • Gateway
  • MasterService
  • ServerService

It isn’t really that big an assembly size/complexity, compared to many other databases (nor should it be).
It writes these kind of files/folders when creating documents:


The edb.log is the file that gets written when I create a document. It writes 4KB pages in sequential order.
e.g.
First document:
Offset: 327,680
Length: 4,096

Second document:
Offset: 331,776
Length: 4,096

The data is not encrypted (this is on Microsoft's roadmap).

Wednesday 5 April 2017

Beware of FreeParking and their domain transfer procedures!

I was contacted by someone who needed some assistance in tracking what had happened to their domain name that they had registered with Freeparking. They had owned this domain for 13 years.

After some investigation it transpired that a third-party had requested a transfer of ownership to FreeParking. They submitted a company letterhead; and following that the domain was transferred. The owner was sent one email that informed them of the pending transfer - and unfortunately that went into the spam email.

That was it. Domain transferred. The original owner didn't find out until weeks later. This is in clear breach of Nominet's registrar agreement that

"B.1.12. act in good faith when correcting a Registrant name on the Register or transferring a domain name to a new Registrant, where we make it possible for you to do so for a domain name on your Tag, and comply with any published requirements (for example, based on the Tag Classification). If you are entitled to make such changes, you must only do so where either (i) you are doing so in accordance with a contract you have with the Registrant and the Registrant was made aware of the relevant terms in advance; or (ii) you have the express permission of the Registrant to make the change; or (iii) you are the Registrant of the domain name;"

So - beware with FreeParking! You can spend a lot of money on a domain and have someone take it off you without much effort if you use FreeParking.