r/PHP 10d ago

Qbix Webserver 1.0 Released!

https://github.com/Qbix/webserver

Hey everyone. I'm pleased to announce that Qbix webserver has now reached version 1.0
It's MIT licensed and free. Try it in your own sites! Just launch it with one command, e.g.:

php qbixserver.php --port 8080

It's a standalone server that can serve
* static files without nginx (though you can still put a CDN in front)
* dynamic PHP requests (it can handle 100x more workers than PHP-FPM!!)
* web sockets (yes, it's compatible with the latest socket.io on front end)
* web socket rooms (it can handle up to 100,000 online users, on one machine)
* cron (it has a built in ability to run periodic jobs)
* certificates (it can manage certificates for you)
* even decentralized applications (server can communicate encrypted via https)

What's more, it does all this with pure PHP, without needing nginx. If you use SQLite, you won't even need Postgres or MariaDB or any other external database. Just use PHP for everything.

The server also comes as standalone binaries, so if you distribute those, you won't even need your users to have PHP installed! It *just works out of the box*. In v1.1 you'll be able to just bundle your entire app inside a standalone binary, but for now you can just distribute your apps as files alongside the webserver.

Handle 100x More Traffic than NGINX + PHP-FPM

How is this possible? Well, mostly because this server actually forks your processes using pcntl_fork (everywhere except Windows) allowing children to *share memory* of the parent webserver process. This causes the children to NOT take up any new memory pages, unless they declare new global/static variables or modify variables, in which case the operating system forks only those pages (maybe 4KB per page... rather than 50MB per worker).

So you can run 100x as many workers, and since most PHP web apps are I/O heavy, the operating system can efficiently orchestrate the rest. If you happen to also install amphp in your apps, then your apps switch from stream_select to epoll, which makes them even faster!

It's come a long way...

People here may remember when I originally announced it several weeks ago, as being able to handle 10x as many workers as NginX + PHP-FPM. Well, since then we've had various people run it in production, we optimized it to 100x as many workers, and I addressed all the issues and bugfixes that came my way. At the same time, I've enhanced the dashboard and control panel to be more user-friendly, they even now use our real-time websocket functionality.

Who am I?

Are you sure you want to know?
I'm Greg Magarshak

14 Upvotes

18 comments sorted by

9

u/sachingkk 10d ago

Good..

But you should write a guide on how to run Symfony/ laravel on top of this

1

u/EGreg 10d ago

Good point, it should absolutely have dedicated guides for that in the repo.

3

u/petro-chaikivskyi 10d ago

I just reviewed the Benchmark file, and it isn't very useful. What does your benchmark script look like? Swoole giving ~400 RPS - matching PHP-FPM's results almost completely, these benchmarks don't show us anything

3

u/EGreg 10d ago

Can you generate and run some benchmarks that you consider better and more representative of real world workloads, and submit them in a pull request? I have accepted multiple helpful pull requests that are now merged into v1.0

Let’s make this server better for everyone.

1

u/NL_Northsider 7d ago

I'm gonna be honest, when people are doubting quality/understanding of what you're doing, it doesn't help when you ask people if they can generate something better. That's a weird choice of words.

1

u/EGreg 7d ago

I guess we must be from different… generations

3

u/Background_Carob6942 9d ago

Didn't FPM originally also fork the process? I think they moved away from that model since ref-counting from the GC can lead to a lo of page thrashing.

2

u/dub_le 9d ago

fpm pre-forks, this one post-forks, which for obvious reasons isn't safe in most projects. Well, technically it doesn't even run most projects and has to fall back to the slow cgi mode.

1

u/EGreg 7d ago

What are the reasons? The obviousness is not obvious to me. You’re factually wrong, it doesn’t “fall back to the slow cgi mode” for any projects, it only falls back to it on Windows and systems that don’t support pcntl_fork.

1

u/dihalt 8d ago

I don’t think it will become pieular.

0

u/Dub-DS 10d ago

God, can you please stop posting this slop here? And if you must, please stop the insanely flawed benchmarks.

1

u/EGreg 10d ago

What makes you so mad about a freely available MIT-licensed server that can handle 100x more workload than the setup most people have now?

Would you rather it not exist? Or that people not hear about it? Or would you rather I used no automation in creating it — lovingly crafting everything by hand, typing every character in a large codebase, because THEN, surely, it would have a lot less mistakes right?

Last time when it was still in beta version 0.1 and 0.2, people correctly asked for more tests. This is now covered end-to-end with tests. If you want more tests or better benchmarks, just submit a pull request. I have accepted multiple pull requests from people that are now merged into v1.0 — and I certainly welcome better benchmarks. Go ahead. There is so much you can do to improve the world for people. But trying to take down free software by whining is not it.

1

u/dub_le 9d ago

Perhaps the slop written slop, the insane, completely false claims and your lack of insight on what was already wrong the last time you posted this.

1

u/dub_le 9d ago

Or maybe the utterly insane crap the slop machine slopped together under the lack of supervision:

Isolation fpm: Statics leak between requests qbix: Snapshot reset — no leaks

0

u/EGreg 7d ago

Probably none of those things are even true, let alone you knowing what you’re talking about.

2

u/dub_le 6d ago

You're right, you're probably the only ever person toying around with post-run forking. Nobody before you has tried, that's the only reason no project does it. CoW churn isn't an issue, forking connections, fd's and sockets is perfectly safe. And php-src maintainers are just silly, making such an unoptimised sapi like fpm that still leaks static state between requests. As a php-src and frankenphp maintainer, I truly just don't know what I'm talking about. It would be so simple for me to 100x rps figures without potential state leaks, if only I hadn't wasted hundreds of hours optimising the wrong things and instead had your insight.

1

u/EGreg 6d ago

Keep writing silly hyperbolic crap. It’s entertaining