Thread overview
Updating D-based apps without recompiling it
Mar 23, 2016
Ozan
Mar 23, 2016
Adam D. Ruppe
Mar 23, 2016
Jesse Phillips
Mar 23, 2016
Jacob Carlborg
Mar 24, 2016
Jesse Phillips
Mar 24, 2016
cym13
Mar 26, 2016
Ozan
Mar 26, 2016
Ozan
Mar 23, 2016
Chris Wright
March 23, 2016
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
March 23, 2016
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.
March 23, 2016
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.
March 23, 2016
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
March 23, 2016
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.
March 24, 2016
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.
March 24, 2016
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/
March 26, 2016
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


March 26, 2016
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