-2

I had built a site in the last week For a simple Registration Process,The process is as mentioned below

  1. Entering Basic details - STEP1
  2. OTP Generated and sent to user and user enters it - STEP2
  3. A Membership Number is displayed to him

I have Used Plain Core PHP with procedural coding

The client says he is expecting 1.2 million people on the launching date and on the basis i assume there may be 2 to 300k requests simultaneously , one doubt i have in mind is Can PHP Code written in Pure Procedural Code Handle this

So I'm stuck on how to proceed with PHP should i change the procedural code to object oriented or should i use framework like codeigniter?

James Z
  • 12,209
  • 10
  • 24
  • 44
NaveenThally
  • 946
  • 1
  • 6
  • 18
  • PHP couldn't care less if you write code procedurally or using OOP. It's all the same opcodes at the lower levels. You should start pondering if your **SERVER** can handle 2-3lahk requests. – Marc B Jan 09 '15 at 14:40
  • @Marc B Thanks for the info,we Have a Linux server , Whether a VPS Hosting would do the job ? – NaveenThally Jan 09 '15 at 17:19
  • "vps hosting" is like saying "we have a car". Big deal. That says nothing. What's the point of having a car if your cargo is the size of a building? – Marc B Jan 09 '15 at 17:21
  • what would be your choice of server which could handle the scenario? – NaveenThally Jan 09 '15 at 17:22
  • again, how should I know? 2-3lahk users hitting a simple `` doesn't a need a big server. And in any case, this is way offtopic. We are not here to tell you how much server to get, or what kind of server. – Marc B Jan 09 '15 at 17:24

1 Answers1

1

See this post:

Differences in procedural and object-oriented implementations of mysql in php?

For your purposes, there is no difference in procedural vs OO. Under-the-hood, they do the same thing. The thread of execution is the same. There is no "asynchronous vs synchronous" or "serial vs parallel" thing going on.

Codeigniter would only have a performance benefit if you use it instead of another framework. You could choose to use it for other reasons, but they aren't related to your stated problem. Your existing PHP should be fine.

Steps 1 and 2 are separate PHP requests. There is no process on the server which persists throughout the user's website visit. You might have lot of visitors viewing the website at the same time, but it is only their server interactions which matter. Suppose you have 2 lakh visitors on the website at peak times, and each visit lasts 15 minutes. That translates into about 200 Step1 requests and 200 Step2 requests per second.

For PHP scripts doing a small number of DB requests and generating a bit of HTML, you might have from 5 to 50 process running simultaneously on the server. That is not a huge load.

Your bottleneck is likely to be in Step1, where you will be emailing 200 passwords per second. You need to use a method that gets the email out of PHP quickly and into the queue for your outgoing mail server. If each mail request were to block your PHP request for 5 seconds, you would need 1000 simultaneous PHP processes. Do some testing, sending out 1000 emails from one PHP script, and see if it takes more than 5 seconds.

If you really need large-scale processing for a 1-day launch, consider cloud hosting where you can use as many servers as you need for a short period of time, at low cost. For example, see:

http://www.rackspace.com/cloud/cloud_bursting

Community
  • 1
  • 1
Tom Robinson
  • 1,850
  • 1
  • 15
  • 14