12

I'm using APE-Project,

Is it better to have 10,000 connected users or 10,000 pages that use a setInterval() to send each N milliseconds a request to a PHP page?

Thanks

Bojangles
  • 99,427
  • 50
  • 170
  • 208
Dal
  • 121
  • 2
  • 3
    CLEARLY this depends on the value of N :) – MarkR Jun 16 '11 at 12:04
  • Would the users open the page every 2 seconds as well? Define "better". If you want the user's to have their information up to date the setInterval approach is better. If you want to save resources the other approach is better because you don't call the page unnecessarily. – Dan Jun 16 '11 at 12:18
  • when you say connected, do you mean using websockets, or the old way? – Mic Jun 16 '11 at 12:21
  • @Mic connected to the APE server. – Dal Jun 16 '11 at 12:22
  • @Dan sincerelly i don't see a PRO using setInterval() because it sends unecessary requests... APE will send message only if there are available, so it's better to have the information up to date – Dal Jun 16 '11 at 12:23
  • @Dal APE should be able to handle 10k connections. so just keep them all open and use websockets. – Raynos Jun 16 '11 at 13:13

2 Answers2

2

APE claims it can scale upto 100k connections per machine. It's using proper evented I/O so it just scales becuase it doesn't have one thread/process per connection.

Just use 10000 connected clients with web sockets.

Raynos
  • 166,823
  • 56
  • 351
  • 396
1

PHP isn't well known to be able to handle large amounts of concurrent long-lived connections. If you decide to use PHP you might want to use setInterval to pull updates from the server. This way you don't have to keep expensive connections open.

TomHastjarjanto
  • 5,386
  • 1
  • 29
  • 41