Re: General use of rewrite / redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 18 March 2008, Aschwin Wesselius wrote:

> Point is: why hitting you webserver with multiple requests per user,
> just after submitting a form or whatever caused the redirect? If you
> have 2 users per day, that won't hurt. But if you have 30.000 concurrent
> users a minute, that could be 60.000 requests (besides all the images,
> stylesheets, javascripts that are being re-requested). Or am I talking
> nonsense?

If you send a redirect header, that gets sent before any HTML gets sent so no 
JS or images are sent either.  The payload cost of a redirect is trivial.

The cost of the second bootstrap process may or may not be problematic.  You 
have to trade that off against the code simplification you can get out of 
redirects (or the code complication you can get if you use it stupidly).  

Take for instance Drupal (which I use as an example because I'm a core dev for 
it).  Drupal does a redirect at the end of every form submission.  That 
redirect is controllable; it could go back to the form ("submit to self"), or 
to a thank you page, or the home page, or to a page in the system that you 
just created, or any number of other places.  That flexibility is worth the 
cost of the second bootstrap (and Drupal's bootstrap is admittedly not 
small), especially because the vast majority of Drupal sites and PHP sites in 
general are read-heavy, not write-heavy, so it's not a substantial number of 
additional bootstraps.  It also means that if the user hits reload, they 
don't resubmit the form because they're not "on" the POST-requested page.  

I will say in general you should not ever have more than one redirect chained 
together.  While there may be valid reasons for it conceptually, trying to 
trace and debug that workflow is overshadow any advantage it could otherwise 
offer.  (IMO, YMMV, etc.)

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux