Current DML implementation is not transactional. It groups keys in batches by their affinity, and then flushes that batches synchronously. This could lead to deadlocks easily.
This could be improved if we sort key within a batch. However, this would require new comparison function for BinaryObjectImpl, as it is not comparable.