vhive-serverless / vSwarm-u

Framework that integrates the serverless benchmark suite vSwarm with gem5, the state-of-the-art research platform for system-and microarchitecture.
https://vhive-serverless.github.io/vSwarm-u/
MIT License
27 stars 4 forks source link

Multiple functions simulaneously #121

Open dhschall opened 4 months ago

dhschall commented 4 months ago

Separate issue for question from @Prithvi-Velicheti in #119

Can we have multiple functions together on Gem5, instead of pinning one function to the core each time ?

dhschall commented 4 months ago

Hi Prithvi, currently, this feature is not supported by default. While there is technically no problem with that, you need to modify some of the scripts.

First, you need to modify the container name in the yaml file: https://github.com/vhive-serverless/vSwarm-u/blob/264d626cf9c7687cb4d8af5601ec587f2e017ae9/simulation/functions/functions.yaml#L28 Otherwise, docker will raise a conflict with the container name.

Then, you also have to modify the pinning itself: https://github.com/vhive-serverless/vSwarm-u/blob/264d626cf9c7687cb4d8af5601ec587f2e017ae9/simulation/wkdir-tmpl/run_sim.tmpl.py#L96 If you name the containers function1 and function2, you have to pin both in this command.

Finally, you also need to run separate instances of the client to drive the functions. One per function.

Note that this can all be easily done and tested in Qemu, and you should only go to the simulator if it's working there. You may find this useful.

Prithvi-Velicheti commented 4 months ago

Thanks a lot @dhschall. I will try and give you some feedback. If I am successful, I can hopefully contribute to the repo.

Prithvi-Velicheti commented 1 month ago

Hi David didnt attempt it till yesterday, because didnt have the requirement at the point of asking. Finally, did it yesterday and observed something like this in m5term, when I am trying to pin 3 containers, fibonacci-go, aes-nodejs and auth-go.

I guess I have to use different ports ?
error_mulf

Prithvi-Velicheti commented 1 month ago

My run_sim.py looks something like this. run_sim_3_functions.py.txt

dhschall commented 1 month ago

Yes, so the problem is that all functions export to the same port 50000 https://github.com/vhive-serverless/vSwarm-u/blob/27a54d7a36ce564d262bdad5a89bd2708930141d/simulation/functions/functions.yaml#L34

Before docker-compose -f /root/functions.yaml up -d {FN_NAME1} {FN_NAME2} {FN_NAME3} you have to change the port mapping. E.g. function1 gets published: 50001 function2 gets published: 50002... Of course you also have to then change your run_sim_3_functions.py file to also use the same ports.

I suggest looking into something like a command line parser (https://unix.stackexchange.com/a/592216) to update the ports.

You can try it before

# Boot in qemu
make -f simulation/Makefile run_emulator

# Change the yaml file.
nano function.yaml
# modify the ports

docker-compose -f /root/functions.yaml up -d {FN_NAME1} {FN_NAME2} {FN_NAME3}
# There should be no conficting ports anymore.

# Try to invoke it with the ports you assigned.
/root/test-client \
    -function-name {FN_NAME1} \
    -url localhost \
    -port <ports you assigned to FN_NAME1>\
    -n {n_invocations} \
    -w {n_warming} \
    -m5ops \
    -input 10
Prithvi-Velicheti commented 1 month ago

Thanks david I will check and let you know.

Prithvi-Velicheti commented 1 month ago

Thank you very much David. It worked and now I got better understanding. Once again I appreciate your work.