digitalmars.D - How can I use D to develop web application?
- zsxxsz (7/7) Sep 13 2011 I find D is a excellent program lang. I usualy use C/C++, sometime using
- sclytrack (3/10) Sep 13 2011 https://github.com/adamdruppe/misc-stuff-including-D-programming-languag...
- zsxxsz (6/16) Sep 13 2011 Thank you very much. I think the cgi module is lower effecient. I found
- Adam Ruppe (6/7) Sep 13 2011 That's not really true. The reason CGI has a perception of being
- zsxxsz (6/13) Sep 13 2011 I don't think so. Because I've been using C to write cgi. One http reque...
- Adam Ruppe (8/11) Sep 13 2011 Have you actually looked at it? I've personally used it on three web
- zsxxsz (3/14) Sep 13 2011 Is so, I'll try it, thanks.
- Andrew Wiley (4/9) Sep 13 2011 Interestingly enough, this benchmark conducted ~10 years ago on a
- Jose Armando Garcia (5/14) Sep 24 2011 Fork creates a child process with an copy of the parent process. Yes,
- Nick Sabalausky (4/15) Sep 13 2011 Accessing a DB, using JS, and sending a page across the internet are all...
- zsxxsz (4/19) Sep 13 2011 I've make a test that forking 1000 processes to execute 1000 tasks on Li...
- Josh Simmons (3/22) Sep 13 2011 You're better off being event based than either of these options, fork
- Trass3r (1/5) Sep 13 2011 Why don't you port them yourself?
- zsxxsz (4/9) Sep 13 2011 Yes, I want to port them from now on, maybe write another one.
- mta`chrono (50/56) Sep 25 2011 I've some D2 code working with fastcgi. It accepts some web request,
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 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? zsxxszI 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
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 don't think so. Because I've been using C to write cgi. One http request one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.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.I feel the cgi library is too simple, so I doubt wether it supports fcgi for 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:Yes, I'm sure. Fork on UNIX or CreateProcess on Win32 are expensive.The fork process is expensive for any OS.Have you actually measured this?Is so, I'll try it, thanks.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
On Tue, Sep 13, 2011 at 8:54 PM, zsxxsz <zsxxsz 263.net> wrote:== Quote from Adam Ruppe (destructionator gmail.com)'s articleInterestingly 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/zsxxsz wrote:Yes, I'm sure. Fork on UNIX or CreateProcess on Win32 are expensive.The fork process is expensive for any OS.Have you actually measured this?
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: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...== Quote from Adam Ruppe (destructionator gmail.com)'s articleInterestingly 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/zsxxsz wrote:Yes, I'm sure. Fork on UNIX or CreateProcess on Win32 are expensive.The fork process is expensive for any OS.Have you actually measured this?
Sep 24 2011
"zsxxsz" <zsxxsz 263.net> wrote in message news:j4o0nn$2igh$1 digitalmars.com...== Quote from Adam Ruppe (destructionator gmail.com)'s articleAccessing a DB, using JS, and sending a page across the internet are all far, far slower than forking.zsxxsz wrote:I don't think so. Because I've been using C to write cgi. One http request one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.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.
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...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.== Quote from Adam Ruppe (destructionator gmail.com)'s articleAccessing a DB, using JS, and sending a page across the internet are all far, far slower than forking.zsxxsz wrote:I don't think so. Because I've been using C to write cgi. One http request one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.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.
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 articleYou're better off being event based than either of these options, fork per request is broken but so is thread per request."zsxxsz" <zsxxsz 263.net> wrote in message news:j4o0nn$2igh$1 digitalmars.com...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.== Quote from Adam Ruppe (destructionator gmail.com)'s articleAccessing a DB, using JS, and sending a page across the internet are all far, far slower than forking.zsxxsz wrote:I don't think so. Because I've been using C to write cgi. One http request one fork cgi which is the reason of slowly performance cgi. The fork process is expensive for any OS.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.
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?Why don't you port them yourself?
Sep 13 2011
== Quote from Trass3r (un known.com)'s articleYes, I want to port them from now on, maybe write another one. The projects's owner port them is the best way, because they are more familer with there programs.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
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? zsxxszI'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