Performance for Product Developers

Post on 28-Jan-2015

118 views 1 download

Tags:

description

 

Transcript of Performance for Product Developers

Matthew Wilkes

Performance for Product Developers

1Friday, 12 October 12

Who am I?

•Performance and security work at the Code Distillery

•Framework and security teams, membership committee

•Foundation board member

2Friday, 12 October 12

Who am I?

•Zope / Plone core developer

•Silly accent. Sorry.

•Not a morning person. Sorry.

3Friday, 12 October 12

Performance…

•Plone is pretty damn fast

•Low edit sites are really easy to make fly

•Runs fine on a 256mb VM

4Friday, 12 October 12

Performance…

•plone.app.caching takes about 5 minutes to configure

•Add Varnish and it goes really rather quick

•Writing is harder

5Friday, 12 October 12

Performance…6Friday, 12 October 12

… for Product Developers?

7Friday, 12 October 12

… for Product Developers

•Security isn’t the sole responsibility of the integrator

•Neither is performance

•Everyone is careful about the code they write

8Friday, 12 October 12

some even over do it9Friday, 12 October 12

Recap

•Don’t add things to the catalog if you can help it

• If you have to, use an indexer, not just a raw FieldIndex

10Friday, 12 October 12

Recap

•Build your types on Dexterity, not Archetypes

• If you’re not sure what structure to use for your data, the answer is OOBTree

11Friday, 12 October 12

Recap

•Avoid big object churn by keeping Lengths of things you need

•Find a balance between huge objects and annotation soup

12Friday, 12 October 12

Recap

• If you see for loops inside for loops you’re probably missing a simpler way

•Don’t forget sets and itertools, they’re good

13Friday, 12 October 12

… for Product Developers

•Very few people are using the tools we have available

•Equally true for publicly available products as for policies

14Friday, 12 October 12

Who’s used this?15Friday, 12 October 12

You guys! Seriously‽16Friday, 12 October 12

I love this chart

0ms

20ms

40ms

60ms

80ms

without cache:ruleset with cache:ruleset0

23

0

56

Access time for a browser view through Varnish

connectprocessing

17Friday, 12 October 12

plone.app.caching

• Assign caching rules directly to contexts by interface

•Can map to an operation, like plone.app.caching.strongCaching

• or to a ruleset, like plone.content.itemView

18Friday, 12 October 12

psst, integrators!

•You can have commit accesstoday

• If your favourite product doesn’t have rulesets defined, add them

• I’ll bring “I cleaned up your mess” stickers to Brasília

19Friday, 12 October 12

Edge Side Includes

photo (c) http://www.flickr.com/photos/fornal/20Friday, 12 October 12

ESIs

•Varnish is your friend

•Lets integrators do page composition

•but easy to leak data

21Friday, 12 October 12

22Friday, 12 October 12

ESI

•Suddenly, cache hits for logged in users!

• aaaand, cache hits on private pages for anonymous

•Really rather bad

23Friday, 12 October 12

ESI

•Set ETags to roles|lastModified?

•ETags can be faked

•Still leaks data

24Friday, 12 October 12

ESI

• Integrators will still have to segment their cache manually

•Hard work

•A lot easier if add-ons are written with this in mind

25Friday, 12 October 12

ESI

•Plan your templates for eventual ESIs

•Many small templates is appropriate, lets them be customised

26Friday, 12 October 12

ESI

• If there is a block of markup that is mostly static but uses the user in some bit, make sure that’s separated out

• Integrators shouldn’t need more than a few minutes to add ESI to your templates

27Friday, 12 October 12

Testing caching

photo (c) http://www.flickr.com/photos/alisdair/28Friday, 12 October 12

Testing

•Far too few people run automated tests on their caching

•Well, far too few people run automated tests at all

29Friday, 12 October 12

Testing

• If you have plone.app.testing based tests already it’s easyish

•Create a new layer using a ZServer and start up Varnish

•Make some testbrowser calls

30Friday, 12 October 12

Things that need building

31Friday, 12 October 12

Utility packages

•We need helper classes and methods for writing caching tests

•Actual tests in popular packages, as examples

32Friday, 12 October 12

Rulesets

•The current plone.app.caching rulesets are integrator focused

•We need some standard ones for product developers to use

33Friday, 12 October 12

The Code DistilleryBristol

Questions?

Want help putting this into practice?sales@thedistillery.eu

34Friday, 12 October 12