Project

General

Profile

Actions

Bug #7121

closed

[Keep] keepstore should use only one buffer for each PUT (and should not deadlock)

Added by Tom Clegg over 8 years ago. Updated over 8 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
Keep
Target version:
Story points:
1.0

Description

PUT uses 2x 64 MiB buffers if the block already exists on disk. One buffer is used to read the request body, the other is used to read the on-disk data into memory in order to compare it with the first buffer.

Aside from wasting memory, this can cause deadlock: if there are N bufferpool slots, and N concurrent PUT requests, each request gets one slot when it starts reading the request body, then all requests deadlock waiting for a "compare" buffer to become available.

We could fix this by adding a Compare() method to Volume (return true if content of file on disk is equal to this buf) instead of holding one buf of client-provided data, reading the data from disk into a second buffer, and comparing them.

It would be even better to do the compare operation while reading the request body from the client. However, this might get complicated: we'd need to read the data from disk at full speed (even if the client connection is slow) to avoid holding the spindle lock too long and shutting out other requests. I suggest we defer this aspect -- for now just fix the deadlock and 2x memory use.


Subtasks 4 (0 open4 closed)

Task #7202: Unit testsResolvedTom Clegg08/24/2015Actions
Task #7201: Add Compare methodResolvedTom Clegg08/24/2015Actions
Task #7217: Fix sleep() in test case by mocking mutexResolvedTom Clegg08/24/2015Actions
Task #7199: Review 7121-fix-deadlock, 94e1489ResolvedTom Clegg08/24/2015Actions

Related issues

Related to Arvados - Bug #6997: [Keep] keepstore reboots GCE host under heavy loadResolved08/16/2015Actions
Actions

Also available in: Atom PDF