开发者

Execute remote Lua Script [closed]

开发者 https://www.devze.com 2022-12-25 09:27 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 5 years ago.

Improve this question

I want to make an application that executes a remote开发者_如何学JAVA 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:

I need high performance to execute the script. So my first choice was Lua script. Someone has another sugestion?

Cause I need high perfomance, I was thinking if the webservice is the best solution. Maybe I could create a TCP/IP Windows Service that hold the users request. It is important to say that I will have many user executing scripts at the same time. So I will have a concurrency problem.

My scripts will query in a database. I will use Tokyo Cabinet or Tokio Tyrant. I think Tokio Tyrant is the only solution cause I will have many requests. For perfomance, Do I need to make a connection pooling? Is there anyway to share variables between webservices requests?

To make the webservice or the Windows service i was thinking to use C++.

Can someone help with these questions?


The user can create a script [and my application will execute it]...

I sure hope you've thought through the security implications!

Suggestions:

  1. Lua is probably plenty fast enough. Lock down the standard libraries or you will regret it. For advice, look on the Lua mailing list—this problem has been solved by many other.

  2. You have a concurrency problem only if you have shared mutable data. To solve your problem, put that data in a database, which manages concurrency.

  3. You have no evidence that performance will be a problem. Pick a database you can live with, do the simplest possible thing, and measure throughput. If it's not fast enough, improve, rinse, repeat.

  4. If you're using Lua you'll find it somewhat easier to interface with C than with C++.

  5. Premature optimization is the root of all evil. Quit worrying about performance and do the simplest thing that could possibly work.

0

精彩评论

暂无评论...
验证码 换一张
取 消