Experience: Developing Cloud Foundry applications with D

Andre via Digitalmars-d digitalmars-d at puremagic.com
Sun Oct 4 12:13:57 PDT 2015


I want to share my experiences with D and the platform as a 
service solution Cloud Foundry. Cloud Foundry supports any 
development language as long it is runnable on Linux 64 bit and 
the application has a http Server listening on a port which Cloud 
Foundry provides you using system environment variable PORT.

I am used to develop on Windows. Using VirtuaBox I created a 
Linux virtual machine. I defined a shared directory between my 
windows host system and the Linux virtual machine. In Addition I 
use Putty as SSH client. In the Putty terminal I execute dub and 
after that the Cloud Foundry console application to push the 
binary to the cloud.

I tried different http servers available for D. At the end I 
decided to build my own.

vibe-d: The linking time of a vibe-d application on a Linux 
system is quite high, I think this is due to the dependencies 
like pthreads and so on. Also the binary size is also quite high. 
As far as I remember around 20 mb for a test application. The 
size matters as you have to upload the application again and 
again. Cloud Foundry provides some shared objects libraries. In 
case you have special requirements like pthreads you must create 
a build pack. With a build pack you can download external 
dependencies and install them while pushing the binary to the 
cloud. There already exists build packs for vibe-d but they are 
outdated. They run a long time and then stops.
 From windows I know vibe-d is a great library but on Linux out of 
the box it doesn't make fun due to the usage of external 
dependencies.

I also had a look at the arsdnet http server. But I didn't 
achieved to get my scenario running. In addition to my http 
server component I have a thread which executes 10 some database 
calls and some http requests. If I am not completely wrong the 
scenario of starting a thread in addition to the main server 
thread is not supported unless I duplicate a big amount of coding 
from the template  "main" of the arsdnet http server component.

In the end I build my own very simple http server component. By 
using the pure phobos library compiling and linking is super fast 
and the size of the full application is around 8 mb. Compile, 
link and pushing to the cloud is possible in less than a minute.

In sum, it is just fun to develop cloud applications with D!



More information about the Digitalmars-d mailing list