Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Add Rust to "Web Framework Benchmarks" #54

Open
derekchiang opened this issue Jan 25, 2014 · 2 comments
Open

Add Rust to "Web Framework Benchmarks" #54

derekchiang opened this issue Jan 25, 2014 · 2 comments

Comments

@derekchiang
Copy link
Contributor

What do you think of adding Rust to the Web Framework Benchmarks using rust-http? I actually started the work already, but was curious what's your opinion.

@chris-morgan
Copy link
Owner

I had considered it but had decided not to expend the effort on it myself until later. I should have known someone else would do it!

rust-http is not really ready for such a thing, but I guess it could go in at least some of the categories. I'd be interested to see how it fares and if it hits errors and such. Provided it fares well it would be good publicity also.

There is one choice for which we have two options: libgreen and libnative. libgreen is moderately fast, libnative is definitely fast (citation: http://cmr.github.io/blog/2014/01/12/the-state-of-rust-0-dot-9/). But on the other hand, libgreen is much more stable; libnative was showing some problems in cmr's benchmarking related to not closing ports properly, which could hinder results or render it a non-starter. If we could try adding benchmarks for both, it would be good.

Switching from libgreen to libnative is pleasantly easy; from the time of cmr's benchmarks:

diff --git a/src/examples/server/apache_fake/main.rs b/src/examples/server/apache_fake/main.rs
index ac5d6db..c43430d 100644
--- a/src/examples/server/apache_fake/main.rs
+++ b/src/examples/server/apache_fake/main.rs
@@ -4,8 +4,11 @@

 #[crate_id = "apache_fake"];

+#[no_uv];
+
 extern mod extra;
 extern mod http;
+extern mod native;

 use std::io::net::ip::{SocketAddr, Ipv4Addr};
 use std::io::Writer;
@@ -62,6 +65,9 @@ impl Server for ApacheFakeServer {
     }
 }

-fn main() {
-    ApacheFakeServer.serve_forever();
+#[start]
+fn start(argc: int, argv: **u8) -> int {
+    do native::start(argc, argv) {
+        ApacheFakeServer.serve_forever();
+    }
 }

In all: my opinion is that rust-http is not ready for a true comparison but I'm pleased you're doing this. Go forth and prosper!

@jroweboy
Copy link

jroweboy commented Feb 5, 2014

Hello! I feel that I'm a little late to this conversation, but a friend and I have been hard at work making an full on web framework for rust built off rust-http called oxidize http://github.com/jroweboy/oxidize. In its current state it can minimally route to functions and load template files and can almost render with mustache. It is planned to have all the staples that you would expect in a usual framework (parametric url routing / Database connectivity / whatever else revel has ;) , but with the additional benefit of being in rust and reaping all the good things that come with that.

I have every intention to eventually add oxidize to the web framework benchmarks one day. That said, there is a few blocks in the way right now. First is that they strongly recommend your serve to support keep-alive and from what I understand rust-http doesn't. Secondly, rust is in constant flux until 1.0 so until then it would be hard to use the most updated version of rust and all the libraries in the benchmarks. So my idea is to make a framework that is at least mostly complete and when those two problems are mostly non issues then I will submit it to web framework benchmarks 😄

If @derekchiang feels like submitting it to them now then go for it! Of course, I think it would be a better idea to help me push oxidize forward though 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants