Racket script or executable as CGI

I am a long-time citizen of the Gemini Protocol and in that arena we use CGI and SCGI to serve dynamic content (gasp I know, but we embrace it - check the link). I created a SCGI server in Racket to serve a basic client/server text-based dice game in Gemini (also written in Racket), but now I wanted to use Racket for CGI for a different project (comment system). For reference, we're talking maybe dozens of users here, not hundreds or thousands. Here are my questions:

  • Compiling racket programs create rather large executables that are not ideal for repetitive execution via CGI (hence I made a SCGI server). Can Racket scripts fill this role, or are they slow in this regard?
  • If the answer to the above is "no" should I pick a different language for efficient CGI scripts? I've used Go in the past because I can get the file size down, but I'd like to stick with Racket.

Any suggestions are appreciated.

I think, the usual advice is to (listed in order of effort):

  • make sure the program is compiled [1]
  • try the demodularizer [2]

If the startup latency is still too high, you can

  • use a daemon

Finally, you can experiment with Zuo. [3]
Zuo is a dialect of Racket tailor-made for cross-platform scripts.
You can compile your Zuo program into a single C-file.

[1] raco make your-file.rkt
[2] raco demodularize
[3] Zuo: A Tiny Racket for Scripting

Let me add a bullet to Jens’ advice:

Write your code in #lang racket/base, and require just those libraries that are needed.
This will reduce start-up time.

Otherwise compiled Racket code should be fast enough to serve a couple of hundred users.

I've used #lang racket/base for making a simple CGI site with net/cgi and haven't experienced any performance issues (although I should emphasize how simple the site is.) The largest issue with respect to latency was when I was outputting xml (output-xml) on individual HTML components, instead of combining all components and outputting xml just once.