In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Most people do not understand the knowledge of this "what is Lua" article, so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can gain something after reading this article. Let's take a look at this "what is Lua" article.
When doing database performance testing, a very common tool is sysbench, and it is very special. The default is to use the Lua template. Some students say what the Lua template is. If you are told that it is a new scripting language, many students will have a big head. Of course, sysbench is not a shopkeeper. You have been equipped with a series of Lua templates, which can basically meet the testing of most scenarios, such as OLTP read-write, read-only, insert. Bulk insert and other templates.'
Of course, not once and for all, if we do some in-depth testing, we will find that there are still some limitations, such as the way the table name is sbtest [n], the table structure is uniformly less than 5 fields, and the table structure information and data cannot be changed directly, so it is still very different from the real scene, the test results are only for reference, if you want to improve, it is better to customize one based on the template depth. This is one of the starting points for me to write this article.
Let's take a brief look at Lua and take a look at its advantages and disadvantages. The language was born at the Catholic University of Rio de Janeiro in Brazil, the script parser is less than 200K, it is very suitable for reading source code learning, and of all the script engines currently, Lua is the fastest. It is used a lot in the game industry, such as in World of Warcraft, which determines that Lua is the best choice as an embedded script. In a very technical comment, that is,
The Lua source code satisfies all our fantasies about programming in the c language and is probably one of the best c open source libraries available.
Of course, it's not good just to talk about it. We have to see what it can't do or what it can't do well. To sum up,
The standard library has too few features, no multi-core support, no unicode support, c api is too difficult to use, and what is more complicated is that Lua version upgrades have always been incompatible, which is very much like the Python brothers, very wayward. Upgrading from 5.1 to 5.2 requires a lot of extra work (the latest version is 5.3.4).
In addition, LuaJIT may also be common, which can be understood as an efficient version of Lua, which makes the ecology of Lua more powerful through ffi. At least when sysbench starts, you will clearly see the following message:
Sysbench 1.1.0 (using bundled LuaJIT2.1.0-beta3)
If you call the lua command at the operating system level, you will find that it comes with the system. The two versions are obviously different.
# lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
At this point, we can set a small goal, and we can customize the Lua template to meet our business needs of the test scenario. If we need to adjust the size of the transaction and the ratio of DML, we can also achieve it flexibly through configuration. Think about how beautiful it is.
So one of the things we need to do is configure it in IDE, and we choose IntelliJ to install a Lua plug-in.
We chose a relatively new version.
Then configure the plug-in in IntelliJ and select the jar package.
This is how the plug-in EmmyLua is installed, and in this way we can first look at the Lua template in sysbench and see what to do next.
If you rebuild a project, we will clearly see the option of this Lua.
I have not learned Lua, but when I read the Lua script, I found that the syntax of Perl in MHA is very similar, there are many I think is the style of c. Overall, it is more readable, because the code of the template is very concise, and we can quickly find the focus. If you want to customize it yourself, it's a little easier than MHA customization (currently patted on the head).
For example, the template of insert is these contents, in addition to the content of oltp_common, the actual logic that needs to be controlled is still very simple.
The above is the content of this article about "what is Lua". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.