Live data from Hacker News

Cloudflare Pages: Best server tech since CGI-bin?

taras.glek.net

201–210 of 226 posts

Re: Cloudflare Pages: Best server tech since CGI-bin?

#201

What is really annoying is that Cloudflare pages will strip the file extension off of your html pages, and perform permanent redirects to those new URLs. Now if you're intending on moving to a new hosting service that doesn't do that (cgi-bin), all Google search results to your site will 404. Github pages and likely others also supports this format, so moving between those two services doesn't exhibit this problem. M…

You can use the more barebones Worker Sites and retain file extensions. Pages has nicer UX (automatic PR preview sites!) but the old school Worker Sites setup is dead simple and does exactly what you want - it's just a template setup to load assets from KV storage. https://developers.cloudflare.com/workers/platform/sites/

It seems workers sites has different pricing compared to pages. Might want to call that out.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#202

Earlier quoted context omitted.

Thanks for the heads up. There's nothing mind blowing on the demo page, but password has been unexpired if you still want to take a look.

It looks like something interesting, I sent an email as I got stuck after the read me and haven't had a lot of time to poke around in the code.

Replied. Cheers!

Re: Cloudflare Pages: Best server tech since CGI-bin?

#203
post #200

Earlier quoted context omitted.

15 years ago Google was considered cool :-)

And 15 years ago it was cool, wasn't it?

Sure it was :-) sadly its true, that you either die cool or see yourself become soulless corporation.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#204

Earlier quoted context omitted.

Sure but developers don't want to bifurcate their service code and releases into a simple version using CGI and a dedicated app server version for when CGI doesn't scale for them or their users. They just want to write one python web app and run it everywhere. There's no way a CGI app can reach a million requests a second on the same hardware that a nodejs (single thread, worker loop) would take to do 1M RPS. Process…

Yep. Also, sharing resources between connections is (at best) very difficult using CGI, and its trivially easy using a stand-alone app server. You can just set up a global variable at process startup and you're done. (This is useful in just about every web app I've ever written - eg for the connection to a database, cached resources, cached renders of common pages, in-memory only security tokens, etc). I also find th…

> Also, sharing resources between connections is (at best) very difficult using CGI, and its trivially easy using a stand-alone app server. You can just set up a global variable at process startup and you're done

You can pass environment variables to CGI scripts as well. In fact, that's exactly how CGI works. Shared resources can be cached in memory through redis, although a shared file (for example sqlite) is enough in many cases.

> I don't need Apache + fastCGI + php + php fastCGI + apache configuration to get started

I'm talking about CGI, not fastCGI

Re: Cloudflare Pages: Best server tech since CGI-bin?

#205
post #131

Earlier quoted context omitted.

> Plain old CGI doesn't scale beyond toy usage--it spawns a process per request. I'd be willing to bet the opposite: CGI is more than enough for 80% of workload, performance-wise. There are a few good reasons why CGI isn't the best today: the tooling doesn't exist, the security model is really bad, and you can cram fewer websites on a single machine, so for the same number of websites you need more machines, and that…

Sure but developers don't want to bifurcate their service code and releases into a simple version using CGI and a dedicated app server version for when CGI doesn't scale for them or their users. They just want to write one python web app and run it everywhere. There's no way a CGI app can reach a million requests a second on the same hardware that a nodejs (single thread, worker loop) would take to do 1M RPS. Process…

That's the problem: people absolutely exaggerate how much their site will need. I didn't say CGI is perfect for everything, I said it is enough for 80% of the websites, for the entire lifetime of said sites. Your blog won't suddenly reach Alexa top 100. Your family sharing photo site will remain seen by your relatives only. You HOA website won't become a trending topic overnight.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#206
post #131

Earlier quoted context omitted.

> Plain old CGI doesn't scale beyond toy usage--it spawns a process per request. I'd be willing to bet the opposite: CGI is more than enough for 80% of workload, performance-wise. There are a few good reasons why CGI isn't the best today: the tooling doesn't exist, the security model is really bad, and you can cram fewer websites on a single machine, so for the same number of websites you need more machines, and that…

Speed is the only reason CGI doesn't fly. What do you think is the upper limit of requests per second, if your HTTP server does process-per-request? For simplicity, assume server class hardware, that each request does no work besides producing a response, and an upper bound of 10k unique remote addresses (i.e. no more than 10k concurrent connections in a different model). How do you think those metrics compare to oth…

> What do you think is the upper limit of requests per second, if your HTTP server does process-per-request ?

In the hundreds, which is absolutely enough for most use cases. If CGI is enough for sqlite.org displaying dynamic content (such as in https://www.sqlite.org/cgi/src/timeline), it is enough for 80% of websites. You are not bigger than sqlite.

> How do you think those metrics compare to other designs

The important question is not "is it better or worse than alternatives" but "is it enough for me". Yes, it is.

> Also, how does this design adapt to HTTP/2?

HTTP/2 doesn't change anything. Requests are on the same socket until the webserver, and the webserver forks a process for each request, multiplexes the responses and all is well.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#207
post #204

Earlier quoted context omitted.

Yep. Also, sharing resources between connections is (at best) very difficult using CGI, and its trivially easy using a stand-alone app server. You can just set up a global variable at process startup and you're done. (This is useful in just about every web app I've ever written - eg for the connection to a database, cached resources, cached renders of common pages, in-memory only security tokens, etc). I also find th…

> Also, sharing resources between connections is (at best) very difficult using CGI, and its trivially easy using a stand-alone app server. You can just set up a global variable at process startup and you're done You can pass environment variables to CGI scripts as well. In fact, that's exactly how CGI works. Shared resources can be cached in memory through redis, although a shared file (for example sqlite) is enough…

Environment variables can’t store a TCP connection to a database or a pre rendered HTML string.

In the latter case you could use redis, but that’s a poor, inconvenient, inefficient replacement for a global variable.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#208
post #61

Earlier quoted context omitted.

No it’s pointing out the server side scripting part which was new to me. do analogs exist in those other hosting options? This seems like a really nice facility - closest analog client side wise is a service worker or something that adjusts fetch.

It's funny, the simplicity really reminds me of server size scripting languages like ASP and PHP.

It's amazing how far I got down in the comments before there was a "This is like X", where X=PHP.

PHP, getting shit done since '95.

Re: Cloudflare Pages: Best server tech since CGI-bin?

#209
post #204

Earlier quoted context omitted.

> Also, sharing resources between connections is (at best) very difficult using CGI, and its trivially easy using a stand-alone app server. You can just set up a global variable at process startup and you're done You can pass environment variables to CGI scripts as well. In fact, that's exactly how CGI works. Shared resources can be cached in memory through redis, although a shared file (for example sqlite) is enough…

Environment variables can’t store a TCP connection to a database or a pre rendered HTML string. In the latter case you could use redis, but that’s a poor, inconvenient, inefficient replacement for a global variable.

Again, I'm not saying CGI is the fastest but that it is fast enough. Opening a new connection (or better yet, using SQLite), reading a file that contains a prerendered HTML string are fast enough for most use cases

Re: Cloudflare Pages: Best server tech since CGI-bin?

#210
[I work at Firebase] Hi folks, I've seen some notable mentions of Firebase in this thread. Last week, during the Firebase Summit we launched preview support for Web Frameworks like NextJS and Angular Universal: https://firebase.google.com/docs/hosting/frameworks-overview

Support during this early preview includes the following functionality: - Deploy Web apps comprised of static web content - Deploy Web apps that use pre-rendering / Static Site Generation (SSG) - Deploy Web apps that use server-side Rendering (SSR)—full server rendering on demand

Cheers,

Post reply on HN