digitalmars.D - How can I use D to develop web application?
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- sclytrack <sclytrack idiot.com> Sep 13 2011
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- Adam Ruppe <destructionator gmail.com> Sep 13 2011
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- Adam Ruppe <destructionator gmail.com> Sep 13 2011
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- "Nick Sabalausky" <a a.a> Sep 13 2011
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- zsxxsz <zsxxsz 263.net> Sep 13 2011
- mta`chrono <chrono mta-international.net> Sep 25 2011
- Trass3r <un known.com> Sep 13 2011
- Andrew Wiley <wiley.andrew.j gmail.com> Sep 13 2011
- Josh Simmons <simmons.44 gmail.com> Sep 13 2011
- Jose Armando Garcia <jsancio gmail.com> Sep 24 2011
I find D is a excellent program lang. I usualy use C/C++, sometime using Java/Php. I hate C/C++ for its lowerly effecient development, and I have Java/Php for it virtual machine. So, I love D very much. But when I want to write some web program, I can't find any useful resources. Anybody else can tell me libraries for web applications? Thanks zsxxsz
Sep 13 2011
https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff cgi == Quote from zsxxsz (zsxxsz 263.net)'s articleI find D is a excellent program lang. I usualy use C/C++, sometime using Java/Php. I hate C/C++ for its lowerly effecient development, and I have Java/Php for it virtual machine. So, I love D very much. But when I want to write some web program, I can't find any useful resources. Anybody else can tell me libraries for web applications? Thanks zsxxsz
Sep 13 2011
== Quote from sclytrack (sclytrack idiot.com)'s articlehttps://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff cgi == Quote from zsxxsz (zsxxsz 263.net)'s articleI find D is a excellent program lang. I usualy use C/C++, sometime using Java/Php. I hate C/C++ for its lowerly effecient development, and I have Java/Php for it virtual machine. So, I love D very much. But when I want to write some web program, I can't find any useful resources. Anybody else can tell me libraries for web applications? Thanks zsxxsz
Thank you very much. I think the cgi module is lower effecient. I found fcgi(http://www.dsource.org/projects/fastcgi4d) and mango(http://www.dsource.org/projects/mango) which support servlet. But they don't support D2, anyone else can merge them to D2? zsxxsz
Sep 13 2011
zsxxsz wrote:I think the cgi module is lower effecient.
That's not really true. The reason CGI has a perception of being slow is because it's used by slow languages most the time, but with D, it's fast. That said, if you still want to use fast cgi, just use -version=fastcgi when compiling with that same module.
Sep 13 2011
== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:I think the cgi module is lower effecient.
slow is because it's used by slow languages most the time, but with D, it's fast.
fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.That said, if you still want to use fast cgi, just use -version=fastcgi when compiling with that same module.
Apache, Nginx or other Webserver.
Sep 13 2011
zsxxsz wrote:The fork process is expensive for any OS.
Have you actually measured this?I feel the cgi library is too simple, so I doubt wether it supports fcgi for Apache, Nginx or other Webserver.
Have you actually looked at it? I've personally used it on three web servers (IIS, Apache, and an embedded server) across two operating systems (Windows and Linux) and three protocols (CGI, FastCGI, and raw http). It'll probably work on other servers and operating systems too, but I haven't tried yet.
Sep 13 2011
== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:The fork process is expensive for any OS.
I feel the cgi library is too simple, so I doubt wether it supports fcgi for Apache, Nginx or other Webserver.
servers (IIS, Apache, and an embedded server) across two operating systems (Windows and Linux) and three protocols (CGI, FastCGI, and raw http). It'll probably work on other servers and operating systems too, but I haven't tried yet.
Is so, I'll try it, thanks.
Sep 13 2011
"zsxxsz" <zsxxsz 263.net> wrote in message news:j4o0nn$2igh$1 digitalmars.com...== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:I think the cgi module is lower effecient.
slow is because it's used by slow languages most the time, but with D, it's fast.
one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.
Accessing a DB, using JS, and sending a page across the internet are all far, far slower than forking.
Sep 13 2011
== Quote from Nick Sabalausky (a a.a)'s article"zsxxsz" <zsxxsz 263.net> wrote in message news:j4o0nn$2igh$1 digitalmars.com...== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:I think the cgi module is lower effecient.
slow is because it's used by slow languages most the time, but with D, it's fast.
one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.
far, far slower than forking.
I've make a test that forking 1000 processes to execute 1000 tasks on Linux, which cost my all CPU and the load average is high. But when use thread pool to execute these same 1000 tasks, the CPU cost and load average are more slower.
Sep 13 2011
== Quote from Trass3r (un known.com)'s articleThank you very much. I think the cgi module is lower effecient. I found fcgi(http://www.dsource.org/projects/fastcgi4d) and mango(http://www.dsource.org/projects/mango) which support servlet. But they don't support D2, anyone else can merge them to D2?
The projects's owner port them is the best way, because they are more familer with there programs.
Sep 13 2011
Thank you very much. I think the cgi module is lower effecient. I found fcgi(http://www.dsource.org/projects/fastcgi4d) and mango(http://www.dsource.org/projects/mango) which support servlet. But they don't support D2, anyone else can merge them to D2? zsxxsz
I've some D2 code working with fastcgi. It accepts some web request, makes live a screenshot of my environment, converts it to png, and sends it back. basically it's an own implementation of the fastcgi protocol. but I think I haven't yet covered all of it. But it's sufficant for me.... /* * main */ int main(char[][] args) { // init FcgiApplication fastcgi = new FcgiApplication(); // listen fastcgi.listen(8080); // redirection fastcgi.accept("/redirect.html", (FcgiRequest request) { request.redirect("http://www.google.de"); }); // dir fastcgi.accept("/users.html", (FcgiRequest request) { request.send("<a href=\"/\">back</a>"); request.send("directory!"); string dir = std.process.shell("ls /etc"); request.send("<pre>" ~ dir ~ "</pre>"); }); // counter int counter = 0; fastcgi.accept("/lukas.html", (FcgiRequest request) { counter++; request.send("hello world!" ~ to!string(counter)); }); // show all variables fastcgi.accept((FcgiRequest request) { request.send("<table>"); foreach(key, value; request.params) { string html = std.string.format("<tr><td>%s</td <td>%s</td></tr>", key, value); request.send(html); } request.send("</table>"); }); // wait until forever return fastcgi.exec(); }
Sep 25 2011
Thank you very much. I think the cgi module is lower effecient. I found fcgi(http://www.dsource.org/projects/fastcgi4d) and mango(http://www.dsource.org/projects/mango) which support servlet. But they don't support D2, anyone else can merge them to D2?
Why don't you port them yourself?
Sep 13 2011
On Tue, Sep 13, 2011 at 8:54 PM, zsxxsz <zsxxsz 263.net> wrote:== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:The fork process is expensive for any OS.
Interestingly enough, this benchmark conducted ~10 years ago on a Pentium 3 found that Fork took less than a millisecond on Linux 2.6: http://bulk.fefe.de/scalability/
Sep 13 2011
On Wed, Sep 14, 2011 at 12:04 PM, zsxxsz <zsxxsz 263.net> wrote:== Quote from Nick Sabalausky (a a.a)'s article"zsxxsz" <zsxxsz 263.net> wrote in message news:j4o0nn$2igh$1 digitalmars.com...== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:I think the cgi module is lower effecient.
slow is because it's used by slow languages most the time, but with D, it's fast.
one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.
far, far slower than forking.
I've make a test that forking 1000 processes to execute 1000 tasks on Linux, which cost my all CPU and the load average is high. But when use thread pool to execute these same 1000 tasks, the CPU cost and load average are more slower.
You're better off being event based than either of these options, fork per request is broken but so is thread per request.
Sep 13 2011
On Tue, Sep 13, 2011 at 7:08 PM, Andrew Wiley <wiley.andrew.j gmail.com> wrote:On Tue, Sep 13, 2011 at 8:54 PM, zsxxsz <zsxxsz 263.net> wrote:== Quote from Adam Ruppe (destructionator gmail.com)'s articlezsxxsz wrote:The fork process is expensive for any OS.
Interestingly enough, this benchmark conducted ~10 years ago on a Pentium 3 found that Fork took less than a millisecond on Linux 2.6: http://bulk.fefe.de/scalability/
Fork creates a child process with an copy of the parent process. Yes, this is very fast on any decent operating system. For cgi to work I am pretty sure you have to call execve which transform a process into another process. That link doesn't measure performance for execve...
Sep 24 2011









zsxxsz <zsxxsz 263.net> 