If, soon after next all those recommendations, you still have problems with RAM and CPU, then possibly it’s since your software is de facto also large, in addition to a Raspberry Pi isn't the right Software for the job. In cases like this, you might want to have a look https://www.mirobot.ai/