Query regarding Anvil Uplink and persistent servers

A very general Question, I have been using the Personal plan under Anvil and have the code ready for both client and server side. I do need the persistent server option as there are certain variables that need to be carried over to other functions. Issues cropped up when trying to use a pandas database (generated in program) for other needs Eg: Buttons to plot graphs or export data based on the database constructed by another function (Any help here would also be greatly appreciated).
Since the Business plan is a bit too expensive for me as this is just a mock trial for now, I thought of using the uplink feature.
Does both client and server side code get carried forward? If so, would creating the uplink to AWS lightsail make it a persistent server akin to the business plan ?

Not sure what you mean by that. When I upgraded to a paying plan, all my projects remained exactly as they were.

Persistent server doesn’t mean it will be up forever. The server will be killed if it is inactive for an (unspecified) while, and can be killed at will, for load balancing or other reasons. And, if the load requires multiple servers to be running at the same time, there is also the risk that two consecutive calls are managed by two independent persistent servers.

Having a persistent server will work as expected most of the time, so you can create read-only global variables, but you need to keep in mind that you can’t rely on it being up 100% of the time.

The lifecycle of an uplink script on the other end, is completely under your control. I have 3 virtual machines in a box in our server room, each running a few uplink scripts. They are always ready to respond to the app requests.

1 Like

Also, this a code smell in python, if your functions require this kind of shared persistent memory structures they are probably also suffering from high coupling.

You shouldn’t need to throw money at this problem, you should probably just be refactoring your code to not need to function this way.

1 Like

I understand your meaning. Design the functions outside to ne called for that particular value.
Thankyou.