Re: [Radiant] Slow page load times

2011-01-23 Thread William Ross
On 23 Jan 2011, at 19:04, Carl Youngblood wrote:

 Hello, we're running a Radiant installation and we're experiencing
 very slow load times. Here's our site:
 
 http://transfigurism.org
 
 We're running it on a linode 512 vm. The site uses the
 radiant_rss_reader extension to construct many different snippets. I
 was wondering if this was the problem, but have checked the RSS cache
 and verified that it is not retrieving the RSS feeds again if they've
 been cached within the set interval (currently 1 hr).

From a brief look it seems that the rss-reader extension disables all page 
caching. It does this in a rather inadvisable way (by amending the Page class 
itself rather than defining a specialist subclass) but since your site is 
primarily an RSS-aggregator, fixing that wouldn't help much.

The extension is quite old and I expect the decision dates back to the old 
radiant cache: with Rack::Cache in front of the whole thing it doesn't make 
sense any more. Simply commenting out these lines in lib/rss_reader.rb:

  def cache?
false
  end

should make a big difference.

best,

will





 
 But it seems that whenever I initiate a refresh from the browser,
 pages take about 30 seconds to load. Almost all of this time appears
 to be spent in ruby. When I click refresh, the CPU load spikes to
 about 60% for the duration of this 30s period and then at the end the
 page appears suddenly, implying that bandwidth and browser rendering
 are not the bottlenecks.
 
 When I click around in the site after going through these slow load
 times for all the pages, they come up very suddenly, leading me to
 believe that they are being served from the radiant cache at that
 point.
 
 My first question is, is there a way to make it so that a browser
 refresh does not cause the radiant cache to be invalidated? I would
 like to set up an hourly cron job that spiders the web site to
 basically prime the cache and make it so that real-world requests
 are served up quickly from the cache instead of having to be re-parsed
 and rendered by radiant.
 
 Second question is, why is my site taking so long for radiant to
 render? It doesn't strike me as an especially complex layout? Is my
 radiant process running out of memory or something? Any
 recommendations on apache and/or db configurations that would help
 here?
 
 Thanks,
 Carl



Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
Thanks a lot for taking the time to respond, Will. I have commented out
those lines and restarted Apache, but I'm still experiencing the same exact
thing. I have confirmed that the ruby processes I see spiking in htop are
new ones, so I'm certain that my changes are being read.

Thanks,
Carl

On Sun, Jan 23, 2011 at 8:50 PM, William Ross w...@spanner.org wrote:

 On 23 Jan 2011, at 19:04, Carl Youngblood wrote:

 Hello, we're running a Radiant installation and we're experiencing
 very slow load times. Here's our site:

 http://transfigurism.org

 We're running it on a linode 512 vm. The site uses the
 radiant_rss_reader extension to construct many different snippets. I
 was wondering if this was the problem, but have checked the RSS cache
 and verified that it is not retrieving the RSS feeds again if they've
 been cached within the set interval (currently 1 hr).


 From a brief look it seems that the rss-reader extension disables all page
 caching. It does this in a rather inadvisable way (by amending the Page
 class itself rather than defining a specialist subclass) but since your site
 is primarily an RSS-aggregator, fixing that wouldn't help much.

 The extension is quite old and I expect the decision dates back to the old
 radiant cache: with Rack::Cache in front of the whole thing it doesn't make
 sense any more. Simply commenting out these lines in lib/rss_reader.rb:

   def cache?
 false
   end

 should make a big difference.

 best,

 will






 But it seems that whenever I initiate a refresh from the browser,
 pages take about 30 seconds to load. Almost all of this time appears
 to be spent in ruby. When I click refresh, the CPU load spikes to
 about 60% for the duration of this 30s period and then at the end the
 page appears suddenly, implying that bandwidth and browser rendering
 are not the bottlenecks.

 When I click around in the site after going through these slow load
 times for all the pages, they come up very suddenly, leading me to
 believe that they are being served from the radiant cache at that
 point.

 My first question is, is there a way to make it so that a browser
 refresh does not cause the radiant cache to be invalidated? I would
 like to set up an hourly cron job that spiders the web site to
 basically prime the cache and make it so that real-world requests
 are served up quickly from the cache instead of having to be re-parsed
 and rendered by radiant.

 Second question is, why is my site taking so long for radiant to
 render? It doesn't strike me as an especially complex layout? Is my
 radiant process running out of memory or something? Any
 recommendations on apache and/or db configurations that would help
 here?

 Thanks,
 Carl





[Radiant] Re: Conditional on URL Subdomain?

2011-01-23 Thread Cleverlemming
Good catch. Looks like I can start with it as a basis for my
extension.

Thanks.

Pete

On Jan 23, 12:00 am, William Ross w...@spanner.org wrote:
 On 23 Jan 2011, at 02:30, Cleverlemming wrote:

  Hail Caesars,

  I see how to use the r:if_url matches tag to server content
  conditionally based on URL, but what about subdomains in the base URL?
  I have a site with several, like military.mysite.com and
  oregon.mysite.com. I'd like the header image and a few other little
  details to change, based on subdomain, but this doesn't warrant
  creating separate sites as most of the content is shared. Do I need to
  make a custom tag?

 Have a look at

        https://github.com/spanner/radiant-mobile-extension

 It's not quite what you're after but should point in the right direction.

 will


[Radiant] Extract the number from the tag list

2011-01-23 Thread rosslaird
I am new to Radiant, and not a (real) programmer, but I am persistent
and willing to try things. Here's what I'm trying to do with the tags
extension: extract the number from the output, style it with css as an
em element, remove the parentheses around the number, and move the
number to before the tag name in the output. So the output, which
currently looks like this:

 a href=/search/by-tag?tag=tag_nametag_name (1)/a
would look like this:

a href=/search/by-tag?tag=tag_nameem1/em tag_name/a

I can see a couple of places in the tag extension files where it looks
like the output is defined, but I don't know enough to feel confident
changing that stuff.

Suggestions are most welcome.


Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
Thanks for the advice Anton. Pages are coming up fast when they are accessed
with a referer header and when they have recently been generated by Radiant.
But they are taking 30s when I type the URL in directly and when I click
refresh in a browser. All this 30s is spent by Radiant generating the page.
No content has yet been sent to the browser at that point, so I am certain
that it is not a browser rendering issue. As soon as the radiant process
finished parsing and compiling the content, the CPU load drops to 1% and the
page is displayed immediately in my browser. All of which points to an issue
on the server side.

The 30 second load time is a secondary problem, but far worse is the fact
that direct hits and browser refreshes cause Radiant to go through all that
unnecessary parsing again. I would like them to merely check when the page
was generated last and not do anything if it's been less than an hour.

On Mon, Jan 24, 2011 at 1:44 AM, Anton J Aylward
radi...@antonaylward.comwrote:

 Carl Youngblood said the following on 01/23/2011 02:04 PM:
  When I click around in the site after going through these slow load
  times for all the pages, they come up very suddenly, leading me to
  believe that they are being served from the radiant cache at that
  point.

 I'd suggest looking into the various developer tool plugins for Firefox.
 What you described here may be an artefact of the browser, not the
 server, caching things like graphics and CSS.

 I found that having the CSS served up as a page, while convenient for
 development, meant more work on the server and database.  Similarly with
 graphics if they needed resizing.

 Once they are cached *in the browser* they don't need to be fetched again.

 You should ask yourself why a page that hasn't been accessed before
 would be in the radiant cache?  When I try your site, hitting a page
 I've not visited before, it comes up fast.


 --
 Quality is free, but only for those who are willing to pay heavily for
 it.- Tom Demarco, Peopleware



[Radiant] Error Creating New Page 0.91 ArgumentError (interning empty string):

2011-01-23 Thread Cleverlemming
Hail Caesars!

I received a 500 Internal Server Error when trying to create a new
page.  Looking through the stack trace, the problem turned out to be
that there was no default page.status set in Radiant::Config. I set it
back to draft and all is well again.

Maybe it makes sense to default to Draft in status.rb if no options
are passed to the intialize method? I

Hope this helps somebody.

Peace,
Pete

Processing Admin::PagesController#new (for 184.100.170.199 at
2011-01-24 00:29:11) [GET]
  Parameters: {page_class=Page, page_id=1, action=new,
controller=admin/pages}

ArgumentError (interning empty string):
  vendor/radiant/app/models/status.rb:14:in `intern'
  vendor/radiant/app/models/status.rb:14:in `[]'
  vendor/radiant/app/models/status.rb:14:in `each'
  vendor/radiant/app/models/status.rb:14:in `find'
  vendor/radiant/app/models/status.rb:14:in `[]'
  vendor/radiant/app/models/page.rb:274:in `new_with_defaults'
  /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/will_paginate-2.3.15/lib/
will_paginate/finder.rb:170:in `method_missing'
  vendor/radiant/app/controllers/admin/pages_controller.rb:21:in `new'
  compass (0.10.6) lib/compass/app_integration/rails/actionpack2/
action_controller.rb:7:in `process'
  vendor/radiant/vendor/plugins/haml/rails/./lib/sass/plugin/rack.rb:
41:in `call'
  passenger (3.0.1) lib/phusion_passenger/rack/request_handler.rb:
96:in `process_request'
  passenger (3.0.1) lib/phusion_passenger/abstract_request_handler.rb:
513:in `accept_and_process_next_request'
  passenger (3.0.1) lib/phusion_passenger/abstract_request_handler.rb:
274:in `main_loop'
  passenger (3.0.1) lib/phusion_passenger/classic_rails/
application_spawner.rb:321:in `start_request_handler'


Re: [Radiant] Error Creating New Page 0.91 ArgumentError (interning empty string):

2011-01-23 Thread William Ross
On 24 Jan 2011, at 06:32, Cleverlemming wrote:

 Hail Caesars!
 
 I received a 500 Internal Server Error when trying to create a new
 page.  Looking through the stack trace, the problem turned out to be
 that there was no default page.status set in Radiant::Config. I set it
 back to draft and all is well again.
 
 Maybe it makes sense to default to Draft in status.rb if no options
 are passed to the intialize method? I

As it happens, the next release will do exactly that as a side effect of the 
new configuration interface.

Thanks for the message, though: very useful.

best,

will




 
 Hope this helps somebody.
 
 Peace,
 Pete
 
 Processing Admin::PagesController#new (for 184.100.170.199 at
 2011-01-24 00:29:11) [GET]
  Parameters: {page_class=Page, page_id=1, action=new,
 controller=admin/pages}
 
 ArgumentError (interning empty string):
  vendor/radiant/app/models/status.rb:14:in `intern'
  vendor/radiant/app/models/status.rb:14:in `[]'
  vendor/radiant/app/models/status.rb:14:in `each'
  vendor/radiant/app/models/status.rb:14:in `find'
  vendor/radiant/app/models/status.rb:14:in `[]'
  vendor/radiant/app/models/page.rb:274:in `new_with_defaults'
  /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/will_paginate-2.3.15/lib/
 will_paginate/finder.rb:170:in `method_missing'
  vendor/radiant/app/controllers/admin/pages_controller.rb:21:in `new'
  compass (0.10.6) lib/compass/app_integration/rails/actionpack2/
 action_controller.rb:7:in `process'
  vendor/radiant/vendor/plugins/haml/rails/./lib/sass/plugin/rack.rb:
 41:in `call'
  passenger (3.0.1) lib/phusion_passenger/rack/request_handler.rb:
 96:in `process_request'
  passenger (3.0.1) lib/phusion_passenger/abstract_request_handler.rb:
 513:in `accept_and_process_next_request'
  passenger (3.0.1) lib/phusion_passenger/abstract_request_handler.rb:
 274:in `main_loop'
  passenger (3.0.1) lib/phusion_passenger/classic_rails/
 application_spawner.rb:321:in `start_request_handler'



Re: [Radiant] Slow page load times

2011-01-23 Thread Carl Youngblood
On Sun, Jan 23, 2011 at 8:50 PM, William Ross w...@spanner.org wrote:

 From a brief look it seems that the rss-reader extension disables all page
 caching. It does this in a rather inadvisable way (by amending the Page
 class itself rather than defining a specialist subclass) but since your site
 is primarily an RSS-aggregator, fixing that wouldn't help much.

 The extension is quite old and I expect the decision dates back to the old
 radiant cache: with Rack::Cache in front of the whole thing it doesn't make
 sense any more. Simply commenting out these lines in lib/rss_reader.rb:

   def cache?
 false
   end

 should make a big difference.


William, I just thought of something. We're running Radiant 0.8.0. Would
this affect your advice at all?

Thanks,
Carl