What technologies are more performant for web development than Nginx and PHP?

2 points by bouldersharp ↗ HN
I would like to know if there is any way to make dynamic websites that perform better than NGINX and PHP, I accept any programming language, even C++

I have tried CGI and C++ but it is extremely slow compared to Apache and PHP. I understand that Node and Python are also slower than PHP.

7 comments

[ 2.8 ms ] story [ 23.9 ms ] thread
What operation are you benchmarking/trying to optimize?
Just a faster alternative than php in general
I mean, if you're looking for performance from the computer, I'd suggest c or rust.

If you are looking for performance from the developer, php or ruby on rails is what I'd suggest.

I have a bunch of little web apps on my home server that are written in Python that use asyncio to do things like control my IoT system. I also write little Python webapps like that when I need to annotate and workflow 5000 documents or images. It is easy and a lot of fun, particularly using websockets, but the workload is not heavy.

Every webapp I've worked on professionally in the last 15 year had the back end written in either a JVM or .NET language, occasionally with some C++ or Tensorflow to implement neural networks. Usually the language has been Java, less frequently it has been Scala (yuck!) or C#.

The performance of that kind of system is very good because both JVM and .NET have solid support for threads and shared memory. If your application has 100 MB of configuration, ML models and other 'constants' you can load it once and access it later at zero cost.

Concurrency is well-supported in the sense of "300 people are making 500 http requests simultaneously" and also "we can simultaneously query 10 databases with 10 threads" and "we can break up a task that takes 500ms on the CPU into multiple tasks that really run on multiple cores."

Rust or Golang are faster. C++ too.

Your mistake was to use CGI instead of FastFGI or using a reverse http proxy. CGI spawns a process per HTTP request, which is very slow whatever the programming language is.

You should use PHP-FPM for calling PHP.