# How does ray server implement variable sharing with fastapi？

**URL:** <https://discuss.ray.io/t/how-does-ray-server-implement-variable-sharing-with-fastapi/5584>\
**Category:** Ray Serve\
**Created:** [March 29, 2022, 12:21pm UTC](https://discuss.ray.io/t/how-does-ray-server-implement-variable-sharing-with-fastapi/5584 "2022-03-29T12:21:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![839576266](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/839576266/32/2235_2.png) [@839576266](https://discuss.ray.io/u/839576266)\
**Post date:** [March 29, 2022, 12:21pm UTC](https://discuss.ray.io/t/how-does-ray-server-implement-variable-sharing-with-fastapi/5584/1 "2022-03-29T12:21:44Z")

</div>

Service.deploymen(args) is implemented in ray server, and args can be obtained in the interface of fastapi, but it should be necessary to share variables between multiple processes. I would like to ask how ray server implements this part? thanks

---

<div class="post-metadata">

**Author:** ![simon-mo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/simon-mo/32/9_2.png) [@simon-mo](https://discuss.ray.io/u/simon-mo)\
**Post date:** [March 29, 2022, 9:36pm UTC](https://discuss.ray.io/t/how-does-ray-server-implement-variable-sharing-with-fastapi/5584/2 "2022-03-29T21:36:03Z")

</div>

The class instance variables are local to each process, they are not shared. Every replica start with a fresh copy and they operate on their own. The main code is here: [ray/http\_util.py at master · ray-project/ray · GitHub](https://github.com/ray-project/ray/blob/master/python/ray/serve/http_util.py#L153)
