www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Nginx to D ?

reply "Larry" <deco33 hotmail.fr> writes:
Hello,

I am not really confident on this one, but could D be interfaced 
with Nginx ?

It would be nice to replace python but if not easily doable, then 
it is a no-no for me.

Any clue on it ?

Thanks
Dec 20 2013
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Friday, 20 December 2013 at 21:21:23 UTC, Larry wrote:
 Hello,

 I am not really confident on this one, but could D be 
 interfaced with Nginx ?

 It would be nice to replace python but if not easily doable, 
 then it is a no-no for me.

 Any clue on it ?

 Thanks
http://dicebot-old.blogspot.co.uk/2013/07/setting-up-simple-vibed-application.html http://dicebot-old.blogspot.co.uk/2013/07/setting-up-simple-vibed-application-app.html
Dec 20 2013
prev sibling next sibling parent reply Max Klyga <email domain.com> writes:
On 2013-12-20 21:21:22 +0000, Larry said:

 Hello,
 
 I am not really confident on this one, but could D be interfaced with Nginx ?
 
 It would be nice to replace python but if not easily doable, then it is 
 a no-no for me.
 
 Any clue on it ?
 
 Thanks
Sure you can. There are three options: 1. Make nginx act as a reverse proxy forwardind all traffic to some socket. You can use vibe.d this way 2. Make a D fastcgi process and point nginx to it. There is Adam Ruppe's cgi.d implementation for example. 3. Write an extension for nginx and use its internal api. Nginx is written in C and D can easily interface with C
Dec 20 2013
parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 20 December 2013 at 21:32:23 UTC, Max Klyga wrote:
 2. Make a D fastcgi process and point nginx to it. There is 
 Adam Ruppe's cgi.d implementation for example.
Yeah, my cgi.d can interface with nginx through fastcgi, scgi, or reverse proxy pretty well. Though my code doesn't scale as well as vibe.d, it is fairly simple to use and isn't particularly slow (vibed wins because it scales well and is fast more than because my code is slow :P ) If you're interested, here's the file: https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/cgi.d my github also has other miscellaneous D modules for things like png images, mysql database access, html dom manipulation, and more. Not super well documented but if you have questions feel free to ask here or on the chat and I can answer them. But if you are going for high load, probably best to try http://vibed.org/ as it scales better and they offer async libs for database and stuff too.
Dec 20 2013
prev sibling parent reply "Larry" <deco33 hotmail.fr> writes:
Let me add a bit more of context : I currently use UWSGI but I 
would like to accelerate python replacing it with D.

Less memory consumption and so on..

I need something as robust as uwsgi.

If there is none, then, no go. :)

Thanks !
Dec 20 2013
next sibling parent "John Colvin" <john.loughran.colvin gmail.com> writes:
On Friday, 20 December 2013 at 21:32:57 UTC, Larry wrote:
 Let me add a bit more of context : I currently use UWSGI but I 
 would like to accelerate python replacing it with D.

 Less memory consumption and so on..

 I need something as robust as uwsgi.

 If there is none, then, no go. :)

 Thanks !
you want http://vibed.org/ the same as in the tutorial links i posted.
Dec 20 2013
prev sibling parent reply "Larry" <deco33 hotmail.fr> writes:
Thanks !

Now, the next question : are those implementations robust ?

Do they bite (are they reliable )?
Do many people use it ?

Remember, I am coming from python where everything is easy and am 
already learning D and decided to give it a jump.
Dec 20 2013
next sibling parent reply "Larry" <deco33 hotmail.fr> writes:
Ok,

thanks you answered while I was typing :)
Dec 20 2013
parent reply "Larry" <deco33 hotmail.fr> writes:
Now,

I assume that it is very fast. But there are no benchmarks under 
heavy loads.

It seems very good but not really commonly used.
Dec 20 2013
next sibling parent "Dicebot" <public dicebot.lv> writes:
On Friday, 20 December 2013 at 21:44:11 UTC, Larry wrote:
 Now,

 I assume that it is very fast. But there are no benchmarks 
 under heavy loads.

 It seems very good but not really commonly used.
Probably only current information about vibe.d performance is this article : https://atilanevesoncode.wordpress.com/2013/12/05/go-vs-d-vs-erlang-vs-c-in-real-life-mqtt-broker-implementation-shootout/ I have been doing some basic benchmarking ~year ago but I have removed those because vibe.d has changed too much since then and I have no infrastructure to reproduce them right now. But comparing to Python performance are likely to skyrocket even it has become twice slower since then (it was faster then CPython + Tornado more than 10x) Reliability is still an issue but it is being worked on as one of priorities. Both vibe.d own website and forum run this very software so it is at least that reliable.
Dec 20 2013
prev sibling parent reply Russel Winder <russel winder.org.uk> writes:
On Fri, 2013-12-20 at 22:44 +0100, Larry wrote:
 Now,
=20
 I assume that it is very fast. But there are no benchmarks under=20
 heavy loads.
=20
 It seems very good but not really commonly used.
Well it is relatively new, and not many people know about D and fewer about Vibe.d. If you use it others will think it is more commonly used :-) --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Dec 21 2013
parent reply "Larry" <deco33 hotmail.fr> writes:
Being one of the pioneers won't make me cry.

I had a look at it. This project seems like it deserves a bit
more work :

http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/7556/

This is particularly annoying and a show stopper for me.

I will definitely look for its evolution though..


I think D is a good language, pretty easy to work with, without
all the cryptic of c++, and really well performing when compiled
with the right options.

To me, it is another world from python.

But when I look at UWSGI, it is directly tied to nginx so no need
to manage yet another server and so on. It just works as is,
redirects to the app and boom, executes the script.

I don't think I want another server behind nginx. But I will lose
the async capability..

tough..
Dec 21 2013
parent "Dicebot" <public dicebot.lv> writes:
On Saturday, 21 December 2013 at 21:15:19 UTC, Larry wrote:
 But when I look at UWSGI, it is directly tied to nginx so no 
 need
 to manage yet another server and so on. It just works as is,
 redirects to the app and boom, executes the script.
There is no practical difference - uWSGI has own protocol, reverse proxy mode uses HTTP for it. But usage remains pretty similar - you just run the app and redirect requests to it, that's all. With added benefit that it is still a 100% feature complete and capable application even without any kind of application server or reverse proxy.
 I don't think I want another server behind nginx. But I will 
 lose
 the async capability..
You don't necessarily need nginx, vibe.d is quite capable to act as only server. It is recommended to put it behind nginx to reduce possible security concerns and because nginx has a lot more options to configure HTTP behavior.
Dec 21 2013
prev sibling parent reply "Dicebot" <public dicebot.lv> writes:
On Friday, 20 December 2013 at 21:38:20 UTC, Larry wrote:
 Do many people use it ?
Not many, as not many people use D in general. No negative feedback from those who have tried so far though ;) You may want to contact developer(s) directly via http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/ for any detailed information.
Dec 20 2013
parent "Larry" <deco33 hotmail.fr> writes:
Thanks a lot !

You are all wonderful and helpful
Dec 20 2013