Bruno Lee
Bruno Lee

Reputation: 1

Executing remote script - Architecture

I want to make an application that executes a remote script. The user can create a script (probabily a LUA script) then stores it in the server. Then he can uses an API for execute the script. I was thinking that API could be a webservice. So my questions are:

Can someone help with these questions?

thanks

Upvotes: 0

Views: 148

Answers (1)

distributed
distributed

Reputation: 116

  • Lua is pretty high performance for a scripting language, especially if you use LuaJIT or something similar.

  • You speak of high performance. How much are we speaking about? Say you have a very simple webservice that executes scripts it receives via POST, then probably the HTTP overhead is comparably small when compared to the Lua compile, environment setup & execution time.

  • About the database I cannot tell you anything. There's many possibilities to do pooling and this also depends on how you execute the Lua scripts. Are they running in a common environment? One per session? One per request?

  • C++ surely is a good choice to host Lua, because Lua fits in pretty well. Though there are other good language bindings as well.

But keep in mind that your job is not over by just sandboxing scripts. User submitted scripts can do a lot other Bad Things(TM), intentionally or by mistake, like allocating a lot of memory or hogging the CPU. In Lua (and I think this is true of many, if not all, sandboxed environments) you cannot do much about this, except killing the offending instance or, if you disallowed using coroutines in your sandbox, yield out of the offending coroutine and do something smarter.

Upvotes: 1

Related Questions