How can I perform hot reload code in tarantool cartridge
without restarting application ?
How can I perform hot reload code in tarantool cartridge?
438 Views Asked by Aleksey Budaev At
1
There are 1 best solutions below
Related Questions in TARANTOOL
- Why does Azure Auto-Scale scale go lower then minimum amount of instances?
- Data execution plan ended with error on DB restore
- Why does Azure CloudConfigurationManager.GetSetting return null
- Do I need other roles than Worker Role for a web site and service layer in Azure?
- Azure Web App PATH Variable Modification
- Azure Data Factory: LinkedService for AzureSql in failed state
- How To Update a Web Application In Azure and Keep The App Up the whole time
- Using Azure MobileServices library with my own LAN WebApi
- ionCube loader error on Azure IIS
- App crash (if closed) after click on notification
Related Questions in TARANTOOL-CARTRIDGE
- Why does Azure Auto-Scale scale go lower then minimum amount of instances?
- Data execution plan ended with error on DB restore
- Why does Azure CloudConfigurationManager.GetSetting return null
- Do I need other roles than Worker Role for a web site and service layer in Azure?
- Azure Web App PATH Variable Modification
- Azure Data Factory: LinkedService for AzureSql in failed state
- How To Update a Web Application In Azure and Keep The App Up the whole time
- Using Azure MobileServices library with my own LAN WebApi
- ionCube loader error on Azure IIS
- App crash (if closed) after click on notification
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In order to find the best solution to your problem it is important to understand what you are trying to achieve. There are 2 possible scenarios:
The first one can be done by unloading a module and loading it again. All modules, when loaded, place themselves to the 'package.loaded' table. So all you need is to update it:
This is a low-level approach that you can generalize: loop over contents of 'package.loaded', unload everything and load it back again. You need to be careful here to not unload the modules that are not present on a filesystem. There is a module that can help you with this: https://github.com/moonlibs/package-reload
While that module will help you with the basics, there are other things you need to consider. In Lua it is very easy to store function pointers inside global objects. If you reload the function itself, you won't magically update all the places that have the pointer to the old function. For example, let's consider the http server:
If you reload mymodule.lua, and not call the router:route again to re-register the handler, HTTP requests will still call the old function.
In cartridge, you usually register functions in apply_config() or init(). See here for example. In order to re-register the callbacks you need to call init() or apply_config() of your roles again. To get a list of roles, you can use cartridge.roles.get_known_roles() . You need to loop over them and re-init them.
In order to call the function that reloads the code, you'll either need to connect through the binary protocol, or use admin socket. Admin socket allows you to write a simple shell script for that. You can get the idea by looking at the tarantool_is_up script . It demonstrates the approach that you can adapt for your use-case.
The second way to achieve this will be to use cartridge-extensions that allows you to push new code through network. It already has some niceties like simplified binding to the public endpoints.