Add basic LRU eviction for the plasma store. (#26)

* Basic functionality for LRU eviction.

* Test eviction.

* Factor out eviction policy.

* Move delete_object into eviction policy.

* Replace array of released objects with an LRU cache (hash table + doubly linked list).

* Finish rebase on master.

* Move actual object deletion away from eviction policy and into plasma store.

* Small fixes.

* Fixes.

* Make remove_object_from_lru_cache always remove the object.

* Minor formatting and comments.

* Pass in allowed memory as argument to Plasma store.

* Small fix.
This commit is contained in:
Robert Nishihara
2016-11-05 21:34:11 -07:00
committed by Philipp Moritz
parent 90a2aa4bf7
commit efe8a295ea
13 changed files with 614 additions and 78 deletions
+8 -4
View File
@@ -1,12 +1,13 @@
from __future__ import print_function
import psutil
import os
import sys
import time
import random
import signal
import sys
import subprocess
import string
import random
import time
# Ray modules
import config
@@ -90,13 +91,16 @@ def start_objstore(node_ip_address, redis_address, cleanup=True):
this process will be killed by serices.cleanup() when the Python process
that imported services exits.
"""
# Let the object store use a fraction of the system memory.
system_memory = psutil.virtual_memory().total
plasma_store_memory = int(system_memory * 0.75)
plasma_store_filepath = os.path.join(os.path.abspath(os.path.dirname(__file__)), "../plasma/build/plasma_store")
if RUN_PLASMA_STORE_PROFILER:
plasma_store_prefix = ["valgrind", "--tool=callgrind", plasma_store_filepath]
else:
plasma_store_prefix = [plasma_store_filepath]
store_name = "/tmp/ray_plasma_store{}".format(random_name())
p1 = subprocess.Popen(plasma_store_prefix + ["-s", store_name])
p1 = subprocess.Popen(plasma_store_prefix + ["-s", store_name, "-m", str(plasma_store_memory)])
manager_name = "/tmp/ray_plasma_manager{}".format(random_name())
p2, manager_port = plasma.start_plasma_manager(store_name, manager_name, redis_address, run_profiler=RUN_PLASMA_MANAGER_PROFILER)