MabezDev / wokwi-server

Other
62 stars 8 forks source link

Websocket message `start` with elf is big and might be delayed for more than 30 seconds #8

Open georgik opened 2 years ago

georgik commented 2 years ago

Situation: Running Wokwi simulation from GitPod https://gitpod.io/github.com/georgik/rustzx-esp32/ .

How to simulate: open URL, run ./start-wokwi.sh

Problem: The message start is delayed for more than 30 seconds, probably due to the size. The user see just simulator that is not running and there is no indication that the simulator is processing data.

Screenshot_20220615_103443

Possible solution: do not send elf file, it's not necessary for Wokwi now, just send empty file instead.

Additional recommendation: add log message that big message is being transferred and display rate of transfer if possible.

FYI: @SergioGasquez @urish

urish commented 2 years ago

How to simulate: open URL, run ./start-wokwi.sh

Should be ./run-wokwi.sh

Note: I couldn't reproduce this on my local windows machine - it works pretty fast here :) But in any case, not sending the .ELF file will probably help to speed up things, especially for slower internet connections - it's another 12MB or so you have to download before the simulation starts running. This makes total sense for localhost development environment, but once you are running on gitpod/similar, those 12MB are not always trivial.

urish commented 2 years ago

On the Wokwi side, you'll now see the following message once the socket has connected, but no command was received:

image

MabezDev commented 2 years ago

Not sure how effective this would be, but we could try compressing the ELF before base64 encoding? If possible it would be great to remove the base64 step entirely, as this inflates the elf size by 33%~.