Answer the question
In order to leave comments, you need to log in
Choice for backend GO or PHP?
I want to make a backend for the application (browser extensions), I have not yet decided whether there will be websocket or standard get requests to the server, but I expect that there can be 10-20 thousand requests per minute. Actually, I think that using GO is cool, etc., but in real conditions and in large loads, I have never used it.
PHP is just time-tested and nothing more.
I thought about nodejs and changed my mind, he didn’t go further than the frontend. and write complex applications on it and then test and debug, you can go nuts from this horror
Answer the question
In order to leave comments, you need to log in
The node has nothing to do with the frontend at all and is not executed in the browser. If websockets, then php is a very, very dubious choice. If it is a node, then in most cases on js there are just bindings for c++ libs. And go is a language with its own specifics, if you use it in the spirit of php, i.e. reflection, late binding, passing interface{}, then it will run at the speed of php.
Of course, go and nodejs are the favorites here, but the question is how you will write on them.
1. The load is measured in RPS - requests per second .
Your dreaded "20,000 requests per minute" turns into a modest 300 rps.
Correctly written PHP code keeps 600-700 rps on one server without any problems.
2. I'll be honest, I've seen very few projects that depended on the performance of the script, much earlier they all rested on the base.
3. In any case, if you really have a loaded project, it makes sense to immediately think about the possibility of full-fledged horizontal scaling. This significantly complicates the development, but really solves the problem. Any dances around the language, specific base, etc. are the forerunners of vertical scaling, not horizontal.
4. In view of the above - absolutely do not care what to write on.
Go - stylish, fashionable, there are very few vacancies, the requirements for them are high - but the salary is cosmic.
PHP - everything is just the opposite, there are a lot of vacancies, the requirements are not high, the salary is different.
As a manager, I choose PHP for projects. What you choose is a matter of your further plans.
As a go fan, I highly recommend Falcon.
Firstly, it will be very difficult to switch to a castrated (compared to Java and pluses) language, it will take at least a month before you write something supported.
And secondly, Falcon is an amazing MVC framework: fast, similar to PHP, with good internal architecture and the ability to write a good one on top of it, which is quite rare among PHP frameworks.
Well, about the node ... I don’t want to enter into a holivar, but the node is an asynchronous feces. Why? For example, here: https://medium.com/@jdan/i-peeked-into-my-node-mod... And all this is asynchronous, and you need to be able to work with it. Goroutines rule.
php7 quickly flies 20 thousand queries is not a problem and you don't need to learn GO.
if you want even faster, you can use the Phalcon framework, it is written in C and constantly hangs in memory, it works even faster (for Phalcon4 you need to use php7.2)
But as the person above wrote, everything can rest against the base, and how the base will be designed a lot depends.
I'll add my 5 kopecks.
There was a question to rewrite the website from PHP to Go. This is because the site is updated every minute, it is generated on the fly, it has many language versions, and in general there are a lot of pages. When crawling Google with a robot, the site starts to slow down.
Since the site is dynamic, PHP handles the Frontend and Backend, generating pages in PHP is expensive. If PHP processed only Backend would leave it as it is.
Conclusion : if you need to get a lot of req / sec (Frontend and Backend) I would still choose Go (AERO, GIN), if Backend PHP is enough (Phalcon or some kind of router framework).
Note : PHP Micro & Router Framework Benchmark
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question