Comment 2 for bug 1556807

Revision history for this message
Yuli (stremovsky) wrote :

One of the reasons of degradation is with the arrays that we store in etcd database objects

For example in lrouter object in database we have an array of ports.

If we cook in add_lrouter_port() function, it does the following code:
1. the code fetches lrouter object from NoSQ
2. performs json decode
3. add new port to the list of ports
4. stringify back to json object
5. stores new lrouter object back to NoSQL

When we have a lot of ports like I do have in stress test (i have hundreds of ports in router)
this becomes an issue. On each new port, the code has to cope with more data:
the json strings are bigger, more memory required to decode them;
we encode them back to string.

I suggest, we might need to store ports not in json array but as a NoSQL array,.
Currently we have /lrouter/<router-id> with a json data

We might add /lrouter/<router-id> and and /lrouter/<router-id>-ports

The new version of the add_lrouter_port() might be very simple.
Instead of reading lrouter and decoding, etc...
We will just push new port to /lrouter/<router-id>-ports

When running the original testwithout add_interface_router() now there is no
degradation, in addition, it is much faster

I created 400 ports in total
time spend to create 100 subnets: 74 seconds
time spend to create +100 subnets: 68 seconds
time spend to create +100 subnets: 65 seconds
time spend to create +100 subnets: 68 seconds