Pretty URL remarks

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #60, on May 1st, 2012, 03:02 PM »
Well, of the three options as I see it, the last one is the only sane way to do it, other than putting a ton of crap in the DB and pushing it out to cache files periodically (which is sluggish and horribly inefficient, and not really any more safe) but it's still a lot of work and I'm not sure how reliable it'll be.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,080
Re: Pretty URL remarks
« Reply #61, on May 2nd, 2012, 07:58 AM »
Are you referring to our SFTP story ('scenario 3'), or to the PURLs talk ('ton of crap in the DB')...?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #62, on May 2nd, 2012, 01:41 PM »
Actually, the former (file access). The alternative to allowing file uploads is to push it all into the DB and call for it as necessary, pushing it out to the cache folder to make it faster. But if that includes executable code, you're still making executable code writable by the webserver owner which makes it vulnerable to abuse from outside. (Cache files are less of a risk because they're purged periodically)

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Pretty URL remarks
« Reply #63, on May 6th, 2012, 09:18 PM »
I need to get testing this properly. It looks like that now I disabled the cache it runs a little slower. DB caching works great but it puts too much junk in the DB without any way to properly purge expired URL's. It looks to me though file caching is in the middle.

I need still need to properly test these, benchmarks and such. So everything I am writing is by speculating by feel, no hard stats. It is going to be hard though to get a mean on a grid hosting account, can't force it to stay on one node, too many resource changes at one time.
Re: Pretty URL remarks
« Reply #64, on May 6th, 2012, 09:29 PM »
Ok, done some testing, will when a cache key exist there is not much difference in speed from no caching at all to caching. It is when the script has to insert a new cache it slows down.

No Caching at all
Code: [Select]
.141
.237
.146
.154
.139
.239
.116
.15
.128
.215

Caching
Code: [Select]
1.186
.352
.134
.153
.346
.244
.312
.133
1.179
.246

As you can see there are spikes, these spikes are caused when a new cache needs to be created. There is basically no gain in caching and no caching is better. :cool:

Nao

  • Dadman with a boy
  • Posts: 16,080

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Pretty URL remarks
« Reply #66, on May 6th, 2012, 11:40 PM »
Quote from Nao on May 6th, 2012, 10:58 PM
So, no file cache then?
I would guess if you had a real memory caching system it would be faster, as for file caching, it is basically useless and DB caching is wasteful.

For me, DB storage I only have 1GB per database. So DB caching for me isn't a option and file caching looks to have no beneficial gain.

I would guess the only benefit you can gain on file caching is if the information is in the DB, other stuff like computing power PHP seems to be able to compute these things faster than a read from a file, well the read isn't the problem, seems like it is the write.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #67, on May 6th, 2012, 11:54 PM »
That would imply then that you want to extend the TTL on caching so that you do fewer writes.

You could leave the caching subsystem in, but only cache things if it's level 2 or higher (so that you actually have to have a proper memory cache in order to use it)

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Pretty URL remarks
« Reply #68, on May 6th, 2012, 11:56 PM »
You know under different circumstances you might want different settings here. Just because my disk I/O is slow doesn't mean that is the case for every server setup. Who knows what scheduler is being used on my server, if writes are slower than reads than there might be a higher priority on them, sounds like deadline to me, but can't be sure.

Then you have your accelerators, if one of these are installed then caching might not be a bad idea.

Maybe these are things that can be determined during setup. Certain test to determine the best setting on the server the site is on.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #69, on May 7th, 2012, 12:10 AM »
Disk I/O is always slower than using memory caches - always. That's why you have memory caches ;) In any case, writes are physically more intensive to perform than reads, in whatever environment you care to name. It's really about the comparative performance which is almost impossible to test meaningfully.

That's really the thing, if cache level >= 2, cache pretty URL stuff, if not, don't.

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Pretty URL remarks
« Reply #70, on May 7th, 2012, 12:38 AM »
Quote from Arantor on May 7th, 2012, 12:10 AM
Disk I/O is always slower than using memory caches - always. That's why you have memory caches ;) In any case, writes are physically more intensive to perform than reads, in whatever environment you care to name. It's really about the comparative performance which is almost impossible to test meaningfully.

That's really the thing, if cache level >= 2, cache pretty URL stuff, if not, don't.
I know memory is faster, my comparison was processing vs disk I/O. Processing seems faster than I/O speeds, but can that be the case on all systems, is the processing always going to be faster than disk I/O on every system?

Writes don't always have to be costly though, but the chances of running into a environment like this is rare, on a server even rarer. Most of my setups, on my local devices I always set up the environments where it favors reads more than writes. Reading is what the user cares the most about.

I agree though, the simple solution is usually the best, if there isn't a memory cache available then only process it.

Nao

  • Dadman with a boy
  • Posts: 16,080

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #72, on May 7th, 2012, 01:42 AM »
Yes, remove DB caching and if any caching is going to occur, do it via cache_put_data if (isset($settings['cache_level']) && $settings['cache_level'] >= 2)

Nao

  • Dadman with a boy
  • Posts: 16,080
Re: Pretty URL remarks
« Reply #73, on May 7th, 2012, 02:32 AM »
Why only on these? Because we are to assume that's only for non-file-based caches?

Also, I wouldn't know how best to store these URLs in a file cache... Per-page basis is meh to me.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Pretty URL remarks
« Reply #74, on May 7th, 2012, 02:37 AM »
Because for file based caches, the available evidence would seem to suggest that the overhead of performing the writing would erode the benefit of caching.

I'm not sure about handling caching either though.