473,725 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Large Scale PHP Application Design Questions

I'm about to start working on my first large scale site (in my opinion) that
will hopefully have 1000+ users a day. ok, this isn't on the google/facebook
scale, but it's going to be have more hits than just family and friends.

Either way, I'm planning on this site blowing up once I have enough of a
feature set, so I'm concerned about performance and scalability in the long
run.

I've worked for a software company, but I've never programmed PHP
professionally (looking for an entry level job, wink wink ).

I was wondering if sites like Sitepoint, MySpace, Facebook, etc... actually
use DB abstraction layers and template engines.

I also plan on using the code for this site for my portfolio, so I'd like to
have as much original code as possible, that's why I'm not even considering
using a framework (I've dabbled a bit with CakePHP and ZF), so I won't
bother asking about using them for large scale sites.

I've been doing a lot of research, and it seems to me that using PHP as a
templating engine itself and creating my own DB class using native DB calls
(going to use MySQL until I find it no longer suites my needs) would be the
most efficient approach.

I do plan on separating Data/Business/Presentation logic to make maintenance
easier, so that's the only reason I'm considering using a Template engine to
separate the Business/Presentation layers, and then either PDO, ADOdb or
PEAR::DB for the data layer.

But once again, I've come to the conclusion that using pure PHP to separate
the Business/Presentation layers, while using my own home brewed DB class as
the data layer would be the best way to go regarding
performance/scalability.

Are there professionals out there with experience working on large scale
sites/applications that can lend their two cents?
Oct 17 '08 #1
22 3659
Jesse Burns wrote:
I'm about to start working on my first large scale site (in my opinion) that
will hopefully have 1000+ users a day. ok, this isn't on the google/facebook
scale, but it's going to be have more hits than just family and friends.

Either way, I'm planning on this site blowing up once I have enough of a
feature set, so I'm concerned about performance and scalability in the long
run.

I've worked for a software company, but I've never programmed PHP
professionally (looking for an entry level job, wink wink ).

I was wondering if sites like Sitepoint, MySpace, Facebook, etc... actually
use DB abstraction layers and template engines.

I also plan on using the code for this site for my portfolio, so I'd like to
have as much original code as possible, that's why I'm not even considering
using a framework (I've dabbled a bit with CakePHP and ZF), so I won't
bother asking about using them for large scale sites.

I've been doing a lot of research, and it seems to me that using PHP as a
templating engine itself and creating my own DB class using native DB calls
(going to use MySQL until I find it no longer suites my needs) would be the
most efficient approach.

I do plan on separating Data/Business/Presentation logic to make maintenance
easier, so that's the only reason I'm considering using a Template engine to
separate the Business/Presentation layers, and then either PDO, ADOdb or
PEAR::DB for the data layer.

But once again, I've come to the conclusion that using pure PHP to separate
the Business/Presentation layers, while using my own home brewed DB class as
the data layer would be the best way to go regarding
performance/scalability.

Are there professionals out there with experience working on large scale
sites/applications that can lend their two cents?
Don't worry about performance until it becomes a problem. 1000 visitors
a day is nothing.

Design a good site and use good programming practices. Things like
templating engines have their use - mostly in rapid development. They
don't necessarily make maintenance any easier or harder.

But also, this may not be the best site for you to cut your teeth on.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 17 '08 #2
Don't expect everything to go just right the first time. Working on a
big project myself (as I learn PHP) I've repeatedly had to go back and
recode finished sections when I ran into a roadblock or potential
design flaw.

If its something that's going to grow, look early-on into how to
organize your files and present your page(s) - partly for security
partly for sanity.

Name your variables, fields, and functions well ( I use: table_field
for all DB fields, and local variables are pretty descriptive too)

Format your code (the PEAR formatting tips are an excellent start).

Setup function libraries for your POST, GET, and DB input/output calls
(just about anything else that gets repeated) so you have just one
place to refine data filtering as you progress.
Find and use a good IDE (I use Quanta on Linux) it does sooo many
great things like project-wide search-replace.

Also PHPMyAdmin is THE BEST utility for doing MySQL development work,
(you should still know how to do MySQL from the MYSQLprompt/ and
direct calls) PHPMyAdmin just makes MySQL work go so much quicker.
Oct 17 '08 #3
On 17 Oct, 03:36, "Jesse Burns" <jburns...@jbwe bware.comwrote:
I'm about to start working on my first large scale site (in my opinion) that
will hopefully have 1000+ users a day. ok, this isn't on the google/facebook
scale, but it's going to be have more hits than just family and friends.
This is not a huge volume.
>
I was wondering if sites like Sitepoint, MySpace, Facebook, etc... actually
use DB abstraction layers and template engines.

I also plan on using the code for this site for my portfolio, so I'd like to
have as much original code as possible, that's why I'm not even considering
using a framework (I've dabbled a bit with CakePHP and ZF), so I won't
bother asking about using them for large scale sites.

I've been doing a lot of research, and it seems to me that using PHP as a
templating engine itself and creating my own DB class using native DB calls
(going to use MySQL until I find it no longer suites my needs) would be the
most efficient approach.

I do plan on separating Data/Business/Presentation logic to make maintenance
easier, so that's the only reason I'm considering using a Template engine to
separate the Business/Presentation layers, and then either PDO, ADOdb or
PEAR::DB for the data layer.

But once again, I've come to the conclusion that using pure PHP to separate
the Business/Presentation layers, while using my own home brewed DB class as
the data layer would be the best way to go regarding
performance/scalability.

Are there professionals out there with experience working on large scale
sites/applications that can lend their two cents?
Think about version control before you start writing the code - it'll
make life a lot simpler in the long run. Similarly plan the testing
ahead - I'd recommend going for continious integration testing as a
must have and unit testing as a nice to have.

Using abstraction anywhere is a trade-off between productivity and
performance - IME having an abstraction layer does not really make
code portable across DBMS. I'm not a fan of pure ORM but encapsulating
data sources as objects (using a factory pattern) can make portability
less painful and make for better code management.

As Larry suggests, stick to a good, standard style guide. Document
your code properly - and find a code document tool which suits you
(PHPDocumentor, PHPXRef....).

Do structure your common code as includes within a directory named in
the include_path, and always include/require using the path relative
to this dir.

When doing your database design - don't use autoincrement ids - this
closes the door on a lot of routes for scaling your application beyond
a single DBMS (use a sequence number and repository identifier (e.g.
DB host name) instead if there is no intrinsic key).

Get your DNS registration seperately from your hosting - if you tie
them both to the same supplier you could end up being held hostage by
their provision plans if you really do hit the big time.

The guideline I've always followed is to avoid writing code wherever
necessary - there is a lot of good quality PHP code published already
and free to use - unfortunately its a very small amount in comparison
to the amount of bad PHP code. You'll always get lots of opinions
here.

HTH

C.
Oct 17 '08 #4
C. (http://symcbean.blogspot.com/) schreef:

(A few comments)
>
Do structure your common code as includes within a directory named in
the include_path, and always include/require using the path relative
to this dir.
That is good advise.

I always include 1 file everywhere in my project too.
Put stuff like this into it:

$newincludepath =
get_include_pat h().PATH_SEPARA TOR.'/whatever/myproject/www/includes';
ini_set("includ e_path", $newincludepath );

Makes life a lot easier indeed, especially when you include other files
in your already included file (or more nesting).
>
When doing your database design - don't use autoincrement ids - this
closes the door on a lot of routes for scaling your application beyond
a single DBMS (use a sequence number and repository identifier (e.g.
DB host name) instead if there is no intrinsic key).
What?
I don't think that is good advise.
IMHO it is ALWAYS a good idea to use autoincrement PRIMARY KEYS on every
table when designing relational databases.

I do not see how this closes the door if you scale your app up to
multiple databases.
Care top explain?
The guideline I've always followed is to avoid writing code wherever
necessary - there is a lot of good quality PHP code published already
and free to use - unfortunately its a very small amount in comparison
to the amount of bad PHP code. You'll always get lots of opinions
here.
Hmm, I prefer writing my own code for excactly that reason! ;-)
It is VERY hard for a newbie to judge which code is good and which code
is bad.
Writing your own code increases your understanding of whatever problem
it is you are working on.

just my 2 cent.

Regards,
Erwin Moller
>
HTH

C.

--
Oct 17 '08 #5
Michael Vilain schreef:
In article <48************ *********@news. xs4all.nl>,
Erwin Moller
<Si************ *************** *************** @spamyourself.c omwrote:
>C. (http://symcbean.blogspot.com/) schreef:

(A few comments)
>>Do structure your common code as includes within a directory named in
the include_path, and always include/require using the path relative
to this dir.
That is good advise.

I always include 1 file everywhere in my project too.
Put stuff like this into it:

$newincludepat h =
get_include_pa th().PATH_SEPAR ATOR.'/whatever/myproject/www/includes';
ini_set("inclu de_path", $newincludepath );

Makes life a lot easier indeed, especially when you include other files
in your already included file (or more nesting).
>>When doing your database design - don't use autoincrement ids - this
closes the door on a lot of routes for scaling your application beyond
a single DBMS (use a sequence number and repository identifier (e.g.
DB host name) instead if there is no intrinsic key).
What?
I don't think that is good advise.
IMHO it is ALWAYS a good idea to use autoincrement PRIMARY KEYS on every
table when designing relational databases.

I do not see how this closes the door if you scale your app up to
multiple databases.
Care top explain?
>>The guideline I've always followed is to avoid writing code wherever
necessary - there is a lot of good quality PHP code published already
and free to use - unfortunately its a very small amount in comparison
to the amount of bad PHP code. You'll always get lots of opinions
here.
Hmm, I prefer writing my own code for excactly that reason! ;-)
It is VERY hard for a newbie to judge which code is good and which code
is bad.
Writing your own code increases your understanding of whatever problem
it is you are working on.

just my 2 cent.

Regards,
Erwin Moller
>>HTH

C.

--
Hi Michael,
I've also only coded small projects and not bothered to use anything but
autoincremented primary keys for my tables that needed them. But I can
see schreef's point for MySQL databases.
His name is NOT schreef.
I am from the Netherlands and my usenetclient is in Dutch.
'Schreef' means 'wrote'.
His nick here is 'C'.
Sorry for the confusion (I'll try to teach my thunderbird to speak
english soon.) ;-)
MySQL doesn't really have the
behind-the-scenes ability to put it's storage in alternate locations.
Then again, I haven't managed large MySQL installations (e.g.
multi-million row tables). There may be a way to store such files
distributed around a filesystem, but I'm not aware of it. Oracle and
other production-class DBMS's allow for allocating tablespaces whereever
you want. It was a common thing to add disks to a server and setup
Oracle data on them when I managed Solaris systems.
Yes, my favorite Postgres can also do that.
And besides that: If you use multiple database (not just a larger
filesystem), you can also still use a (centrally distibuted)
autoincrement PK.

>
So, I think schreef's workaround for this shortcoming is to use
multi-system databases. schreef, can you explain what you mean and why?
C (alias 'schreef' from now on ;-) ), generally knows very well what he
is talking about, so I am curious too. :-)

Regards,
Erwin Moller
Oct 17 '08 #6
Michael Vilain wrote:
In article <48************ *********@news. xs4all.nl>,
Erwin Moller
<Si************ *************** *************** @spamyourself.c omwrote:
>C. (http://symcbean.blogspot.com/) schreef:

(A few comments)
>>Do structure your common code as includes within a directory named in
the include_path, and always include/require using the path relative
to this dir.
That is good advise.

I always include 1 file everywhere in my project too.
Put stuff like this into it:

$newincludepat h =
get_include_pa th().PATH_SEPAR ATOR.'/whatever/myproject/www/includes';
ini_set("inclu de_path", $newincludepath );

Makes life a lot easier indeed, especially when you include other files
in your already included file (or more nesting).
>>When doing your database design - don't use autoincrement ids - this
closes the door on a lot of routes for scaling your application beyond
a single DBMS (use a sequence number and repository identifier (e.g.
DB host name) instead if there is no intrinsic key).
What?
I don't think that is good advise.
IMHO it is ALWAYS a good idea to use autoincrement PRIMARY KEYS on every
table when designing relational databases.

I do not see how this closes the door if you scale your app up to
multiple databases.
Care top explain?
>>The guideline I've always followed is to avoid writing code wherever
necessary - there is a lot of good quality PHP code published already
and free to use - unfortunately its a very small amount in comparison
to the amount of bad PHP code. You'll always get lots of opinions
here.
Hmm, I prefer writing my own code for excactly that reason! ;-)
It is VERY hard for a newbie to judge which code is good and which code
is bad.
Writing your own code increases your understanding of whatever problem
it is you are working on.

just my 2 cent.

Regards,
Erwin Moller
>>HTH

C.

--

I've also only coded small projects and not bothered to use anything but
autoincremented primary keys for my tables that needed them. But I can
see schreef's point for MySQL databases. MySQL doesn't really have the
behind-the-scenes ability to put it's storage in alternate locations.
Then again, I haven't managed large MySQL installations (e.g.
multi-million row tables). There may be a way to store such files
distributed around a filesystem, but I'm not aware of it. Oracle and
other production-class DBMS's allow for allocating tablespaces whereever
you want. It was a common thing to add disks to a server and setup
Oracle data on them when I managed Solaris systems.
MySQL5.1 has tablespaces and the ability to store tables in different
places via the: DATA DIRECTORY='/full/path', and INDEX
DIRECTORY='/full/path/' directives.

http://dev.mysql.com/doc/refman/5.1/...ate-table.html

....about half way down the page. Some catches, haven't tried it myself.

So, I think schreef's workaround for this shortcoming is to use
multi-system databases. schreef, can you explain what you mean and why?
--
Norman
Registered Linux user #461062
Oct 17 '08 #7
Thanks for the feedback folks, it's much appreciated.
"Jesse Burns" <jb*******@jbwe bware.comwrote in message
news:gd******** **@aioe.org...
I'm about to start working on my first large scale site (in my opinion)
that will hopefully have 1000+ users a day. ok, this isn't on the
google/facebook scale, but it's going to be have more hits than just
family and friends.

Either way, I'm planning on this site blowing up once I have enough of a
feature set, so I'm concerned about performance and scalability in the
long run.

I've worked for a software company, but I've never programmed PHP
professionally (looking for an entry level job, wink wink ).

I was wondering if sites like Sitepoint, MySpace, Facebook, etc...
actually use DB abstraction layers and template engines.

I also plan on using the code for this site for my portfolio, so I'd like
to have as much original code as possible, that's why I'm not even
considering using a framework (I've dabbled a bit with CakePHP and ZF), so
I won't bother asking about using them for large scale sites.

I've been doing a lot of research, and it seems to me that using PHP as a
templating engine itself and creating my own DB class using native DB
calls (going to use MySQL until I find it no longer suites my needs) would
be the most efficient approach.

I do plan on separating Data/Business/Presentation logic to make
maintenance easier, so that's the only reason I'm considering using a
Template engine to separate the Business/Presentation layers, and then
either PDO, ADOdb or PEAR::DB for the data layer.

But once again, I've come to the conclusion that using pure PHP to
separate the Business/Presentation layers, while using my own home brewed
DB class as the data layer would be the best way to go regarding
performance/scalability.

Are there professionals out there with experience working on large scale
sites/applications that can lend their two cents?

Oct 18 '08 #8
Jesse Burns wrote:
I'm about to start working on my first large scale site (in my opinion) that
will hopefully have 1000+ users a day. ok, this isn't on the google/facebook
scale, but it's going to be have more hits than just family and friends.

Although I agree with other commentators, I would say that for really
heavyweight stuff don't start with MySQL, but PostGres.

I wish I had started with Postgres on my main project.
Oct 18 '08 #9
Hugh Oxford wrote:
Jesse Burns wrote:
>I'm about to start working on my first large scale site (in my
opinion) that will hopefully have 1000+ users a day. ok, this isn't on
the google/facebook scale, but it's going to be have more hits than
just family and friends.

Although I agree with other commentators, I would say that for really
heavyweight stuff don't start with MySQL, but PostGres.

I wish I had started with Postgres on my main project.
Although PostGres is also a good database, MySQL is quite capable with
large projects.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Oct 18 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2277
by: Constandinos Mavromoustakis | last post by:
CFP: CLADE 2004-Challenges of Large Applications in Distributed Environments ------------------------------------------------- PhD student - Dept.Informatics at Aristotle University of Thessaloniki URL-> http://agent.csd.auth.gr/~cmavrom -------------------------------------------------- -------------------------CLADE 2004--------------------------- Challenges of Large Applications in Distributed Environments June 7th, 2004, Honolulu,...
9
2421
by: limor | last post by:
Hi, I am considering using Python in a new testing tool application we intend to build for out product. I must get references before starting develope in this language , since although lots of good things are said about this language , I still have my doubts how can it compete with languages like C++ and Java. I have found te sytax and some features if the language not as problematic in maintenance prospective (although I keep reading...
36
6393
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but something I'll need in this case is some experience-based set of rules about how to use python in this context. For example... is defining readonly attributes in classes worth the hassle ? Does duck-typing scale well in complex
2
3571
by: Kymert persson | last post by:
Hi. I was wondering if there are any more C++ books along the lines of "Large scale C++ software design" by Lakos, J. I.e. concerning larger design issues in close relation to C++. I have made a fairly thorough literature search, but i haven't found anything fitting this criteria. In general there seems to be a huge amount concerning the C++ language as such and more "narrow" design issues, e.g. along the lines of Meyers Effective-
26
2221
by: yoda | last post by:
Hi guys, My situation is as follows: 1)I've developed a service that generates content for a mobile service. 2)The content is sent through an SMS gateway (currently we only send text messages). 3)I've got a million users (and climbing). 4)The users need to get the data a minimum of 5 seconds after it's generated. (not considering any bottlenecks external to my code). 5)Generating the content takes 1 second.
9
1632
by: Da~One | last post by:
This message has been posted to 2 groups, one to the VB.NET group, and the other to C#. I am trying to decide which language to commit to for a large scale project. I am looking for the input of people who have gone through this process before. I am currently leaning towards C# solely because I envision VB.NET slowing down exponentially as projects are added with the constant background compilation.
1
5764
by: Maria DiGiano | last post by:
I am using Access to organize data from a survey which uses a Likert scale to measure response- the scale is 3 points- "I agree", "I don't know" and "I disagree". The numerical value of each response (1, 2 or 3) varies- such that for some questions "I agree" is = to 3 points, and other times "I agree" is = to 1. I created an "answer key" table, such that each record is a question, and for the fields of "I agree", "I disagree" and "I...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.