Live data from Hacker News

Low-level web programming in Racket and a wiki in 500 lines

matt.might.net

1–10 of 29 posts

Re: Low-level web programming in Racket and a wiki in 500 lines

#2
How fast is web-server/servlet? Is it fit for production use?

Last time I checked (which was, admittedly, a long time ago) it served noticeably fewer "hello, template world" requests per second than Flask running on Python 2.7 while using more RAM. This was a pity to me because I thought Racket could otherwise be a very interesting language for web development.

Re: Low-level web programming in Racket and a wiki in 500 lines

#3
I'm glad to see someone talking about using the lower-level web libraries in Racket. The high-level continuation-based ones are ridiculously unsuitable for actual web programming (they store full state on the server at all times, and the URL gives you full access to the session, among other issues), but the lower-level ones actually look pretty clean and modern. And yet all the documentation keeps talking about the continuation stuff, bizarrely.

Re: Low-level web programming in Racket and a wiki in 500 lines

#4
This is very useful. I'm in the middle of a Racket web project right now and I got hung up on parsing/processing form data. The Racket docs are very thorough, but they can be confusing if you don't know what you're looking for.

If anyone here has experience with web stuff in Racket, I've set up a small skeleton for Racket web projects: https://github.com/samertm/web-project-bootstrap.rkt

Right now it contains skeletons for talking to sqlite, setting up a router and handlers, and manipulating the web server from the command line. I need to add an ORM (I'm not sure if Racket has any up-to-date ORMs?) and static file handlers. I'd love help or feedback!

Re: Low-level web programming in Racket and a wiki in 500 lines

#5
post #4

This is very useful. I'm in the middle of a Racket web project right now and I got hung up on parsing/processing form data. The Racket docs are very thorough, but they can be confusing if you don't know what you're looking for. If anyone here has experience with web stuff in Racket, I've set up a small skeleton for Racket web projects: https://github.com/samertm/web-project-bootstrap.rkt Right now it contains skeleto…

From you experience, how is performance? what would you compare it too? The examples ae useful, thank you.

Re: Low-level web programming in Racket and a wiki in 500 lines

#6
post #5
post #4

This is very useful. I'm in the middle of a Racket web project right now and I got hung up on parsing/processing form data. The Racket docs are very thorough, but they can be confusing if you don't know what you're looking for. If anyone here has experience with web stuff in Racket, I've set up a small skeleton for Racket web projects: https://github.com/samertm/web-project-bootstrap.rkt Right now it contains skeleto…

From you experience, how is performance? what would you compare it too? The examples ae useful, thank you.

I haven't written any big projects in Racket, so I can't say how it fares on real-world projects with real-world data, but here are the results for a very minimal Racket project using ApacheBench:

~ $ ab -n 100 -c 10 "http://localhost:8888/"

This is ApacheBench, Version 2.3

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done

Server Software: Racket

Server Hostname: localhost

Server Port: 8888

Document Path: /

Document Length: 89 bytes

Concurrency Level: 10

Time taken for tests: 0.084 seconds

Complete requests: 100

Failed requests: 0

Total transferred: 26800 bytes

HTML transferred: 8900 bytes

Requests per second: 1192.32 [#/sec] (mean)

Time per request: 8.387 [ms] (mean)

Time per request: 0.839 [ms] (mean, across all concurrent requests)

Transfer rate: 312.05 [Kbytes/sec] received

Re: Low-level web programming in Racket and a wiki in 500 lines

#7
post #6
post #5

Earlier quoted context omitted.

From you experience, how is performance? what would you compare it too? The examples ae useful, thank you.

I haven't written any big projects in Racket, so I can't say how it fares on real-world projects with real-world data, but here are the results for a very minimal Racket project using ApacheBench: ~ $ ab -n 100 -c 10 " http://localhost:8888/" This is ApacheBench, Version 2.3 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benc…

Without a baseline comparison against other servers with same functionality on the same computer, these results mean nothing.

For example here are benchmarks from Django's single-threaded debug webserver:

Benchmarking 127.0.0.1 (be patient).....done

Server Software: WSGIServer/0.1

Server Hostname: 127.0.0.1

Server Port: 8000

Document Path: /

Document Length: 2 bytes

Concurrency Level: 10

Time taken for tests: 0.100 seconds

Complete requests: 100

Failed requests: 0

Total transferred: 16400 bytes

HTML transferred: 200 bytes

Requests per second: 998.90 [#/sec] (mean)

Time per request: 10.011 [ms] (mean)

Time per request: 1.001 [ms] (mean, across all concurrent requests)

Transfer rate: 159.98 [Kbytes/sec] received

Or Nginx returning the same thing:

Benchmarking 127.0.0.1 (be patient).....done

Server Software: nginx/1.6.2 Server Hostname: 127.0.0.1 Server Port: 9080

Document Path: /gangam Document Length: 14 bytes

Concurrency Level: 10 Time taken for tests: 0.013 seconds Complete requests: 100 Failed requests: 0 Total transferred: 15600 bytes HTML transferred: 1400 bytes Requests per second: 7478.31 [#/sec] (mean) Time per request: 1.337 [ms] (mean) Time per request: 0.134 [ms] (mean, across all concurrent requests) Transfer rate: 1139.27 [Kbytes/sec] received

Re: Low-level web programming in Racket and a wiki in 500 lines

#8
Just being exposed to Racket last month I was extremely surprised at how well it clicked with me as opposed to Haskel which I tried to learn for a few months on my own and just tried out SML and it moved to Racket. Can't put a finger on it but Racket just makes sense to me.

Re: Low-level web programming in Racket and a wiki in 500 lines

#9
post #8

Just being exposed to Racket last month I was extremely surprised at how well it clicked with me as opposed to Haskel which I tried to learn for a few months on my own and just tried out SML and it moved to Racket. Can't put a finger on it but Racket just makes sense to me.

I felt the same way, Racket is ridiculously fun to use! :)

Re: Low-level web programming in Racket and a wiki in 500 lines

#10
post #4

This is very useful. I'm in the middle of a Racket web project right now and I got hung up on parsing/processing form data. The Racket docs are very thorough, but they can be confusing if you don't know what you're looking for. If anyone here has experience with web stuff in Racket, I've set up a small skeleton for Racket web projects: https://github.com/samertm/web-project-bootstrap.rkt Right now it contains skeleto…

How exactly are you hung up with form data? Its low level, so you certainly can't get validation out of box, but otherwise in my experience getting form data out is fairly straight forward. I recently wrote my first Racket web app. Its not pretty or following best practices but you can take a look.

https://github.com/vishesh/whalebin

Post reply on HN