Repository navigation
Experimental: enable automatic GCS flushing with configurable policy. - #2266
Conversation
|
Test FAILed. |
6db5aa5 to
76ceca7
Compare
|
Test PASSed. |
|
Test FAILed. |
| int ChainTableAdd_RedisCommand(RedisModuleCtx *ctx, | ||
| RedisModuleString **argv, | ||
| int argc) { | ||
| RedisModule_AutoMemory(ctx); |
There was a problem hiding this comment.
Did this fix the problem you were seeing with memory not being reclaimed even when flushing?
There was a problem hiding this comment.
That's right.
|
Jenkins retest this please |
There was a problem hiding this comment.
There is a Python linting error on travis and also the following error in the RAY_USE_NEW_GCS build:
======================================================================
ERROR: test_credis_started (__main__.CredisTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/credis_test.py", line 31, in test_credis_started
chain = primary.execute_command('MASTER.GET_CHAIN')
File "/home/travis/.local/lib/python3.6/site-packages/redis-2.10.6-py3.6.egg/redis/client.py", line 668, in execute_command
return self.parse_response(connection, command_name, **options)
File "/home/travis/.local/lib/python3.6/site-packages/redis-2.10.6-py3.6.egg/redis/client.py", line 680, in parse_response
response = connection.read_response()
File "/home/travis/.local/lib/python3.6/site-packages/redis-2.10.6-py3.6.egg/redis/connection.py", line 629, in read_response
raise response
redis.exceptions.ResponseError: unknown command 'MASTER.GET_CHAIN'
----------------------------------------------------------------------
| ray.worker.global_worker.check_connected() | ||
| redis_client = ray.worker.global_worker.redis_client | ||
|
|
||
| serialized = flushing_policy.serialize() |
There was a problem hiding this comment.
Given that the corresponding deserialization call is self.gcs_flush_policy = pickle.loads(serialized), shouldn't we just call pickle.dumps here?
There was a problem hiding this comment.
Good call. Adding serialize() to the abstract interface is probably overkill.
| self.redis.execute_command("HEAD.FLUSH 0") | ||
| except redis.exceptions.ResponseError as e: | ||
| log.info("Turning off flushing due to exception: {}".format( | ||
| str(e))) |
There was a problem hiding this comment.
This would be a good place to push an error to the driver I think (ray.utils.push_error_to_driver).
There was a problem hiding this comment.
Seems complicated for a harmless operating mode
There was a problem hiding this comment.
If an exception raised here, isn't that a bug?
There was a problem hiding this comment.
It can happen when (1) Ray is not compiled from source with the flag RAY_USE_NEW_GCS, (2) BUT somehow at run time RAY_USE_NEW_GCS is provided. This seems a harmless setup issue, not a bug?
There was a problem hiding this comment.
It's important to push an error to the driver here. Otherwise the user will spend a lot of time trying to figure out what is going wrong.
| if time.time() - self.last_flush_timestamp < self.flush_period_secs: | ||
| return False | ||
|
|
||
| reply = redis_client.execute_command("INFO MEMORY") |
There was a problem hiding this comment.
redis_client.info("memory")["used_memory"]
There was a problem hiding this comment.
Great catch! Thanks.
| # Set up logging. | ||
| logging.basicConfig() | ||
| log = logging.getLogger(__name__) | ||
| log.setLevel(logging.INFO) |
There was a problem hiding this comment.
This doesn't seem like the right place to set up a global logging variable.
There was a problem hiding this comment.
I removed these.
| return pickle.dumps(self) | ||
|
|
||
|
|
||
| def set_flushing_policy(flushing_policy): |
There was a problem hiding this comment.
Raise an exception when this is called if we are not using the new GCS.
|
Test PASSed. |
|
Test FAILed. |
concretevitamin
left a comment
There was a problem hiding this comment.
Done, PTAL?
| # Set up logging. | ||
| logging.basicConfig() | ||
| log = logging.getLogger(__name__) | ||
| log.setLevel(logging.INFO) |
There was a problem hiding this comment.
I removed these.
| if time.time() - self.last_flush_timestamp < self.flush_period_secs: | ||
| return False | ||
|
|
||
| reply = redis_client.execute_command("INFO MEMORY") |
There was a problem hiding this comment.
Great catch! Thanks.
| return pickle.dumps(self) | ||
|
|
||
|
|
||
| def set_flushing_policy(flushing_policy): |
| ray.worker.global_worker.check_connected() | ||
| redis_client = ray.worker.global_worker.redis_client | ||
|
|
||
| serialized = flushing_policy.serialize() |
There was a problem hiding this comment.
Good call. Adding serialize() to the abstract interface is probably overkill.
| self.redis.execute_command("HEAD.FLUSH 0") | ||
| except redis.exceptions.ResponseError as e: | ||
| log.info("Turning off flushing due to exception: {}".format( | ||
| str(e))) |
There was a problem hiding this comment.
Seems complicated for a harmless operating mode
|
Test PASSed. |
|
|
||
| max_entries_to_flush = self.gcs_flush_policy.num_entries_to_flush() | ||
| num_flushed = self.redis.execute_command( | ||
| "HEAD.FLUSH {}".format(max_entries_to_flush)) |
There was a problem hiding this comment.
Why not expose a thin wrapper around this command? That would give users the maximum flexibility.
There was a problem hiding this comment.
I think it's important/beneficial to emphasize the automatic aspect of this feature. This will encourage the users to play with the simple policy first. We want to develop that to a mature enough degree.
There was a problem hiding this comment.
Sure, but then for it to be useful it needs to work perfectly. If we expose this command then the bar is lower and the user will usually be able to work around problems.
|
Test PASSed. |
|
Travis is green now modulo valgrind |
* 'master' of https://github.com/ray-project/ray: (157 commits) Fix build failure while using make -j1. Issue 2257 (ray-project#2279) Cast locator with index type (ray-project#2274) fixing zero length partitions (ray-project#2237) Make actor handles work in Python mode. (ray-project#2283) [xray] Add error table and push error messages to driver through node manager. (ray-project#2256) addressing comments (ray-project#2210) Re-enable some actor tests. (ray-project#2276) Experimental: enable automatic GCS flushing with configurable policy. (ray-project#2266) [xray] Sets good object manager defaults. (ray-project#2255) [tune] Update Trainable doc to expose interface (ray-project#2272) [rllib] Add a simple REST policy server and client example (ray-project#2232) [asv] Pushing to s3 (ray-project#2246) [rllib] Remove need to pass around registry (ray-project#2250) Support multiple availability zones in AWS (fix ray-project#2177) (ray-project#2254) [rllib] Add squash_to_range model option (ray-project#2239) Mitigate randomly building failure: adding gen_local_scheduler_fbs to raylet lib. (ray-project#2271) [rllib] Refactor Multi-GPU for PPO (ray-project#1646) [rllib] Envs for vectorized execution, async execution, and policy serving (ray-project#2170) [Dataframe] Change pandas and ray.dataframe imports (ray-project#1942) [Java] Replace binary rewrite with Remote Lambda Cache (SerdeLambda) (ray-project#2245) ...
Example usage illustrated in this test program (which submits no-op tasks continuously).
Result shows that the policy can control memory usage to the minimum possible level, on the primary redis server.
