Continued explorations of winnowing the size of the OpenStack placement service by attempting to remove requirements and adjust code imports, all within a container for easy isolation. The previous discussion is at Placement Container Playground 2.
Today I decided I wanted to run the setup from Placement Scale Fun against the container experiments, so that it was easy to add more placement services on different hosts.
But first, based on the earlier exploration, I integrated three more changes into the container setup:
- Using nova.db.api
directly. This makes it
so that
nova/db/__init__.py
has no code and thus does not inadvertently load in more modules. - Moving DB constants to own file. This was needed so that the inventory handler for placement (which uses some of the constants) doesn't have to load other stuff.
- Isolate configuration loading. This has placement using its own code to load and process configuration so that it doesn't have to import RPC and DB related modules that it doesn't use.
With those changes integrated (the Dockerfile, which makes no claim to being proper, can be found in the placedock repo), along with the changes listed in the previous post, the size of an individual placement UWSGI process shrinks. In my environment after running under load for a while:
- Master: VSZ:
273924
, RSS106216
- Lightweight: VSZ
180840
, RSS74452
This is nice, but I suspect there's more room to be saved if we want.
With that in place, I set up 4 containers running placement. Two on the control plane host, and two on the compute host. The apache configuration for proxying to multiple UWSGI services looks like this (assuming the generic uwsgi stuff is set up elsewhere, which devstack does for you):
<Proxy balancer://placement>
BalancerMember uwsgi://127.0.0.1:8080/
BalancerMember uwsgi://127.0.0.1:8081/
BalancerMember uwsgi://192.168.1.149:8080/
BalancerMember uwsgi://192.168.1.149:8081/
</Proxy>
ProxyPass "/placement" balancer://placement
This works well when creating a bunch of instances as described in the scale fun. Requests were nicely balanced around the 4 containers, each of which kept a nice stable size and didn't sweat.
There are a few remaining warts being loaded into the service that it would be nice to avoid:
oslo_service
is loaded for the sake of setting somelog_options
. This means eventlet and greenlet are in the mix. These are not needed by placement.castellan
is imported bynova/conf/key_manager.py
. That is imported as a result of wanting to usenova.conf
. This results in a mess of cryptography related modules and libraries being required.
It's not immediately obvious if there are workarounds for these issues. At least not prior to placement having its own configuration file and setup.