www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Updating D-based apps without recompiling it

reply Ozan <ozan.sueel gmail.com> writes:
Hi


Enterprise applications in productive environments requires 
smooth updating mechanisms without recompiling or reinstalling. 
It's not possible to stop an enterprise application, then run 
"dub --reforce" and wait until finish. Mostly only few functions 
need to be replaced.

Has someone experience with handling upgrading/updating D-Apps on 
the fly?

Working with dynamic libraries or distributed components is not 
secure enough,
but maybe there are solutions, maybe around base calls and 
functions or completely different.


Regards, Ozan
Mar 23 2016
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
On Wednesday, 23 March 2016 at 12:21:33 UTC, Ozan wrote:
 Has someone experience with handling upgrading/updating D-Apps 
 on the fly?
The way I always did it was to simply have old and new running side-by-side in the transition. So, without stopping the old version, compile the new one and start it. Tell the web server to start using the new one for all new connections without breaking any existing connections. Then when all existing connections are finished, you can stop the old one and remove it.
Mar 23 2016
prev sibling next sibling parent reply Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
On Wednesday, 23 March 2016 at 12:21:33 UTC, Ozan wrote:
 Hi


 Enterprise applications in productive environments requires 
 smooth updating mechanisms without recompiling or reinstalling. 
 It's not possible to stop an enterprise application, then run 
 "dub --reforce" and wait until finish. Mostly only few 
 functions need to be replaced.

 Has someone experience with handling upgrading/updating D-Apps 
 on the fly?

 Working with dynamic libraries or distributed components is not 
 secure enough,
 but maybe there are solutions, maybe around base calls and 
 functions or completely different.


 Regards, Ozan
Do you have an example of this being done in any other language? Essentially whatever code is being replaced, you're going to need to recompile it. If you're not using dynamic/shared libraries Adam is pointing you in the right direction. If it is a desktop application then it is probably easiest if it communicates to a local service that provides the "replaceable" functions, when you stand up the new service the app can transfer the communication to it. I can't speak to your security concerns.
Mar 23 2016
next sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2016-03-23 18:15, Jesse Phillips wrote:

 Do you have an example of this being done in any other language?
In Erlang it's possible to hot swap code. I'm not sure how it works though. But if we're talking servers, the easiest is to have multiple instances and restart one at the time with the new code. -- /Jacob Carlborg
Mar 23 2016
parent reply Jesse Phillips <Jesse.K.Phillips+D gmail.com> writes:
On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg wrote:
 On 2016-03-23 18:15, Jesse Phillips wrote:

 Do you have an example of this being done in any other 
 language?
In Erlang it's possible to hot swap code. I'm not sure how it works though. But if we're talking servers, the easiest is to have multiple instances and restart one at the time with the new code.
Looks like it is doable because it is byte code: http://erlang.org/doc/reference_manual/code_loading.html#id88478 My recommendation would have been using a DLL, but that was already excluded as an option.
Mar 24 2016
parent reply cym13 <cpicard openmailbox.org> writes:
On Thursday, 24 March 2016 at 18:46:43 UTC, Jesse Phillips wrote:
 On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg 
 wrote:
 On 2016-03-23 18:15, Jesse Phillips wrote:

 Do you have an example of this being done in any other 
 language?
In Erlang it's possible to hot swap code. I'm not sure how it works though. But if we're talking servers, the easiest is to have multiple instances and restart one at the time with the new code.
Looks like it is doable because it is byte code: http://erlang.org/doc/reference_manual/code_loading.html#id88478 My recommendation would have been using a DLL, but that was already excluded as an option.
It can be done in compiled languages too, here an example of a library that allows it in C http://kitsune-dsu.com/
Mar 24 2016
parent Ozan <ozan.sueel gmail.com> writes:
On Thursday, 24 March 2016 at 23:03:54 UTC, cym13 wrote:
 On Thursday, 24 March 2016 at 18:46:43 UTC, Jesse Phillips 
 wrote:
 On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg 
 wrote:
 On 2016-03-23 18:15, Jesse Phillips wrote:

 Do you have an example of this being done in any other 
 language?
 My recommendation would have been using a DLL, but that was 
 already excluded as an option.
It can be done in compiled languages too, here an example of a library that allows it in C http://kitsune-dsu.com/
Great link. Thanks for it
Mar 26 2016
prev sibling parent Ozan <ozan.sueel gmail.com> writes:
On Wednesday, 23 March 2016 at 17:15:35 UTC, Jesse Phillips wrote:
 On Wednesday, 23 March 2016 at 12:21:33 UTC, Ozan wrote:
 Hi


 Enterprise applications in productive environments requires 
 smooth updating mechanisms without recompiling or 
 reinstalling. It's not possible to stop an enterprise 
 application, then run "dub --reforce" and wait until finish. 
 Mostly only few functions need to be replaced.

 Has someone experience with handling upgrading/updating D-Apps 
 on the fly?

 Working with dynamic libraries or distributed components is 
 not secure enough,
 but maybe there are solutions, maybe around base calls and 
 functions or completely different.


 Regards, Ozan
Do you have an example of this being done in any other language? Essentially whatever code is being replaced, you're going to need to recompile it. If you're not using dynamic/shared libraries Adam is pointing you in the right direction. If it is a desktop application then it is probably easiest if it communicates to a local service that provides the "replaceable" functions, when you stand up the new service the app can transfer the communication to it. I can't speak to your security concerns.
I'm working in SAP area. The main application servers are based on C++. Every part which is not core could be replaced. Applications running in ABAP are also replaceable (thanks to the JIT) There are also solutions in Java. Application Servers are typical solutions, where code, libs and apps could be replaced without recompiling. Dub is great, but business applications requires more the framework or platform approach. I will try out Martin Nowak's example from DConf. Looks like a solution for me... Regards Ozan
Mar 26 2016
prev sibling parent Chris Wright <dhasenan gmail.com> writes:
On Wed, 23 Mar 2016 12:21:33 +0000, Ozan wrote:
 Enterprise applications in productive environments requires smooth
 updating mechanisms without recompiling or reinstalling.
The industry standard is to build on a build server and stop the application to update, but to have enough redundancy that users don't see any interruption of service. That's how Google and Amazon do it. There are a bare handful of systems that let you avoid that process. In general, it's hard enough for humans to reason about how their application's durable state will handle application updates; adding volatile state into the picture is much harder, and for little gain.
Mar 23 2016