Hello, I have been studying php for half a year already, I have created a couple of sites, but I have always been bored with creating dynamic sites, I use ajax + php for this. So, does it make sense to use ajax + php + sockets, for more than a real time site and how will it work under heavy loads or is it better to use nodejs?

Can you please detailed answers.

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants Dmitriy Simushev , user194374, Denis Bubnov , ermak0ff , aleksandr barakin 4 Feb '17 at 10:14 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • four
    Nobody will answer you this question. What are strong loads? 1000 visitors? Million? Two cripples for lunch? What do you have in the database - two tables or 300? What do you have on your server - decrepit iron or fresh SSD? And so on. - u_mulder
  • 2

1 answer 1

You do not understand the architecture of really high loads.

It doesn’t matter what software you use on the server. For example, using PHP, you can squeeze a productivity of 1000 users, using a node - 2000 users, using an assembler - 3000.

So the hayload is not about the fact that you need to urgently switch to assembler, but about the fact that any stack of technologies used is guaranteed to shut up on millions of users (large social networks, search engine sites).

Therefore, they start architecturally devising techniques for how to set up hundred servers, so that they are enough to handle the load.

There are many ways (heard for example such a word as "sharding"?), The architecture can be applied to both the node and PHP.

Choosing a stack is done at the start of a project, often for historical reasons. Say, some c # programmers gathered together - and began writing stackoverflow on .net, and Zuckerberg came up with the idea of ​​writing a facebook - chose PHP because he knew how or seemed simpler. What they knew how - on that and start.

A sharp stack change in the middle of a project, when you have hundreds of servers and dozens of programmers who know this stack, is a rare and insane thing. Well, you earn twenty servers - on a hundred servers it can be a savings on matches, compared to the fact that you need to fire all programmers, hire new ones and all this without downtime. Business will not approve.

There is nothing more to say about this. He is very vague and difficult to give an objective answer.

  • Well, what are you? Language influences time and opportunity. Although highly dependent on architecture, I agree. - user207618
  • one
    There is nothing crazy about changing the stack, you can drive a few at a time. For example, I have a service on perl, everything works, except that the last perl programmer remains. Leave at any time. We rewrite the service on something else, and go in parts, node by node .. Language is not a sacred cow. - vp_arth
  • 2
    @vp_arth In the gradual - no, in the sharp - there is. And the more gradual - the greater the cost of transition, the business is the more not like it. I do not mind your remarks, but completely agree: I just needed to sharpen the wording to make it clearer for the questioner, and you, as a commentator, have another task: to show that there is nothing unequivocal and you need to look at the circumstances in each case. - AK