Category Archives: Meetup Slides

October Slides: High-Performance WordPress Websites with Sonja London

Presentation Summary

Speed matters. No one wants to wait around for your site to load, especially on a phone. And WordPress isn’t known for being fast: one of the key selling points of WordPress managed hosting is the server-side caching.

Sonja London has been doing performance tuning since before WordPress was invented. She explains how to determine what’s slowing your site down and what to do about it. Don’t settle for the generic suggestions provided by Google PageSpeed Insights: following them may make no difference at all if your real problem lies somewhere else.

Presentation Slides

Sallie’s Notes

Remember to ask

  • How fast does it need to be?
  • Are you being paid to speed it up?

What Is Performance?

Performance is not speed, but speed is a component of performance. You want your page to load in under 2 seconds. Or at least most of your pages.

Throughput is the number of transactions per second that an application can handle. Throughput can assassinate speed.

Using tests as metrics vs. what the client experiences (what if they have an iPhone 3?)

Latency is (usually) defined the time between making a request and beginning to see a result. (Start of page load.) If a site is slow everywhere for everyone, it’s probably the site. But if the site is slow only for people in a certain area, it’s probably something to do with their connection. Latency is usually beyond your control as a developer.

A HILARIOUS slide of a test where the site is rated F but loads in 1.2 seconds.

What are you testing? Where does the test bot live? Some of the criteria used by GTmetrix et al. are not very logical. Sonja says that Google Pagespeed Insights may be a better tool for beginners

Use PingPlotter for measuring latency and also packet loss.

Deliver only what you need, where you need it, when you need it, from where it should be. And make your clients do it, too.

Hosting

The most important things for your host: location, location, location (well, for their data centers, anyway)

Server configuration: memory, SSD, CPU speed/cores

Who is really hosting? Do they have their own data centers, or do they buy rack space from somewhere?

That’s not necessarily bad, but you want to be sure that the actual servers are good.

Plugin performance: the simple thing is to test speed first, install, test after.

Use SEO Framework instead of Yoast. (I’ll have to look at it.)

If you have to use a page builder, read Pippin Williamson’s review.

The Database

There are multiple MySQL engines. Find out what your host uses. Some are better than others for transactions. You can have more than one kind of engine in a database (by table). If you write a plugin that creates a table, you can specify the engine. And most hosts let you choose between a couple of different ones within phpMyAdmin. Some hosts also let you choose in cPanel.

The most common are MyISAM and InnoDB. InnoDB is better for transactions and low-level locking.

If you need something temporary, you can just do it in memory.

Federated tables don’t exist in your system. They are somewhere else. This is a bit above my head, but it’s a way to share data.

Plugins and your Database

Watch out for WordFence: not only does it create too many tables, but it uses camel case for table names. Capitals are not allowed in databases on Windows. It throws errors with things like duplicated. Just keep all your table names lower case.

Some plugins have too much logging, and people forget to turn it off when they go to production. Always turn off logging if you want performance.

LOOK AT YOUR DATABASE. Find out what tables are in there. Beware of duplicates caused by migrations.

Know when to use an abstraction layer. (WP’s functions.) Most of the time you SHOULD use WP’s functions. Use dbDelta (https://developer.wordpress.org/reference/functions/dbdelta/) to create tables.

Use Query Monitor to keep track of your queries.

Plan for the future.

For really high-end sites, consider HyperDB, which distributes your database to help with heavy transaction processing. (Hmm…meetup about HyperDB? Meetup about the GPL?)

Maintain your database. Clear out things like autosaves and revisions, transients, users who are no longer active, etc.

Test your database performance periodically. Just because it was good two years ago, doesn’t mean it’s good now. If your page speed is good, the DB is probably okay, but look at queries, the size of the DB, etc.

Caching

What the cache does is store things as HTML instead of going to the database every time.

Opcode (like APC) is for PHP

Memcached is for SQL

CDNs serve your site from multiple data centers, close to the people visiting. (Which reminds me…) Depending on your problems, a traditional CDN may not help.

Turn on browser caching via .htaccess.

Compression

Compress All the Things. Bake it into your development process. PrePros GUI for automation (instead of Gulp, if you don’t like the command line)

Choose your image format based on the type of image it is. Consider SVG for your logo.

You can also enable GZIP compression via .htaccess. Vary accept encoding. (Google that. It’s for compatibility with CDNs.) You can use it for the basics (text, html, CSS, JS, etc.), or you can apply it to All the Things

Operating System & Web Server

Linux and Apache are the most common, but Nginx is becoming increasingly popular. Sometimes they get combined in a reverse proxy. Nginx is faster.

Tools

  • Monitor.us  and Uptime Robot are good tools to use. They can monitor from multiple locations at different times. Note that if you are on shared hosting and you monitor really often, the host might object.
  • GTmetrix, ySlow, Google PageSpeed Insights, Pingdom
  • Query Monitor and Debug Bar plugins for your dev server. (Take off production server)
  • PingPlotter
  • .htaccess Guide

Send your questions to sonja@zosi.me

June 2016: Git Version Control for the Complete N00b

Adam LaBarge from Hyperarts introduced us to Git and GitHub: installing Git on Windows and Mac, cross-platform GUI clients for Git, repositories like GitHub, GitLab, and BitBucket, deploying from Git to WP Engine, and other useful tools for developers.

Notes from Adam’s Git Presentation

Git was invented by Linus Torvalds.

What’s different about Git? It takes snapshots of your data as your file changes. Git manages the version you see when you open the file.

Everything is local: all the changes and history are on your machine, so you can work without a network connection. If a teammate’s repo is destroyed, you’ll still have everything.

Git is an “add-only” program–it ‘s very hard to get it to delete anything.

WordPress updates are a key reason to use Git. You don’t want to overwrite working code.

You only want working code on stage and master.

Git is amazing for managing your team code efforts…though it IS possible to overwrite your co-workers’ code, so you have to do it right.

You will thank yourself for having a Git workflow and sticking to it.

INSTALLING

Git is basically a command-line app. There is a terrible default GUI, and some other GUIs, but some things HAVE to be done on the command line.

There are install packages for Linux, Mac, and Windows. Be aware that you need to specify that you’re using Git for Windows when searching for help for Windows machines.

GUI APPS

If you don’t want to use the command line, you can use something like SourceTree or GitHub Desktop.

The GitHub app gives you a good introduction, but it has some drawbacks, especially if you’re dealing with a huge number of files.

GIT SERVERS

Repositories are a place to save your code but they also offer additional services.

You can belong to multiple repositories on GitHub, BitBucket, etc. You can scan your code for PHP errors in the process of pushing it to your repository.

Git by itself is just versioning, not user management. For user management you need a Git server, either one you create yourself or a hosted server like GitHub.

GIT COMMANDS

Commit
Push
Pull
Fetch
Branch/Fork
Merge
Revert
Checkout/Reset
Conflict

Fetch gets code from a remote repo, but without merging it into your local repo.

Branches: there should be at minimum master (production), stage (for the staging server, to test), and whatever working branches you want. When you’ve finished testing, merge locally, then push to repo.

Git does not have a pre-defined workflow, so you have to create one for yourself and your team. Don’t MAKE changes on the stage or master branch. Make them in a branch and merge.

SourceTree will let you know if someone else has made changes that you need to pull down. (A pull notification means there’s something you need to pull down.) Ideally, you won’t have two people working on the same branch at the same time, but let’s face it, it will happen. If you’re both working on the same branch and you get a pull notification, stop what you’re doing, merge your changes, fork the staging branch, pull down the changes. Merge his changes to your branch, and if they work, back to stage.

“If you’re not sure what’s going on, make a fork of what you’re working on.”

You can force push your changes and re-set the repository.

Whether you create a readme file and a .gitignore file on GitHub depends on whether you’ve already got them on your local.

GIT DEPLOY TO HOSTING

WP Engine Git Deploy only goes one way, so you really want EVERYTHING in your local Git repo. (Or, well, the repo where you’re keeping stuff, which could be on GitHub or wherever.)

SiteGround’s Git Tutorials

It’s easier to use the HTTPS version than the SSH, because with SSH you have to generate keys. Alas, both WP Engine and SiteGround require SSH keys. There seems to be an assumption you’re going to be working from GitHub so you can generate keys there.

If your code is already on a host, you can push the code from your host to GitHub and then pull it to your local install. (Assuming you have SSH access, of course.)

WORKING WITH GIT

Don’t be scared to delete Git and start again.

Revert is a pain. Switching branches is easier.

If you don’t commit a change, there won’t be any record of it, so if you want it saved for posterity, commit it!

Before you do anything else, “git status” to find out where you are and what’s pending

The head is the last point of the current branch.

If you find a conflict, humans have to intervene: contact your colleague and decide whose version to use. You have to tell Git you resolved the conflict by re-adding the files.

April 2016 – WordPress and Business Intelligence Presentation

Thanks to everyone who attended this past Sunday in our new meetup location. Here’s my presentation on Business Intelligence and WordPress, which I’ve uploaded to SlideShare.

Sallie’s Notes on Anca’s Business Intelligence Presentation

Definition of Business Intelligence: The tools and techniques to acquire data and transform into meaningful and useful information.

Some questions that business intelligence is designed to answer:

  • Who are my best customers?
  • How much money have I made this year?
  • What will it take to fulfill an order or provide a service? (COGS and overhead)
  • How effective are our marketing campaigns?
  • How well are our systems working?

The answers to these questions help you determine which products to keep, whether to add or reduce staff, whether to enter or exit a market, which marketing campaign to undertake

So where does WordPress fit in?

You can use WordPress to manage your organization and centralize forms, content, commerce, appointments/events, services, social conversation, contracts and payments, account management.

Tech Liminal uses a lot of services, and they’re planning to narrow that down. Getting rid of EventBrite, for instance. Every system creates friction in your business. Make a mind map of these for yourself so you can figure out which ones you don’t need.

“We never use our Google Sites ‘Intranet’: it’s a pain.”

Beware of VC-funded startups that are not yet profitable: they may go away and take your data with them. (Lisa LaMagna had this experience with Zirtual.)

Business Intelligence Reports and WordPress

AMR Users plugin will tell you anything at all about your site’s users. It’s very fast to query because it caches tables.

WooCommerce reporting will show you how much you’ve made, and you can export it, but it’s incomplete. There’s always more that you want. There are several reporting extensions for WooCommerce to expand what you get in the basic package.

One of WP’s strengths is the small number of database tables. In terms of what you want to report on, it’s posts, post meta, users, user meta, terms, term meta.

The meta tables help keep the main tables simple. Writing SQL queries goes well when you have a moderate number of users and meta records. But meta tables can really blow up.

If you write plugins, remember that storing data in an array makes it harder to query.

When you get hundreds of thousands of users, your queries start to time out because there is SO MUCH META. For a while you can just increase your hosting, but eventually you have to find another solution.

Creating intermediary tables to make reporting more efficient. It takes about 10 seconds to generate this table for 290,000 users on the Social Media Week site. Intermediary tables do not mess with the original data.

For displaying these tables, Anca uses jQuery Tables.

Understand your metrics: what are you trying to measure? You can’t measure everything.

Business Intelligence Takeaways

  • Learn where the data is.
  • Learn a little SQL.
  • Make your report actionable.
  • Leverage third-party services.

Business Intelligence Tools

Domo business cloud lets you aggregate your data and report on it. (It’s a data warehouse, a term Anca hasn’t used for a long time..)

Google Sheets (or Excel) for viewing all that table output and creating graphs. Sonja says that the number one business intelligence tool is Excel.

If you start using Salesforce, you will need to learn how to use SQL queries.

Points to Remember

  • The thing about data is that your brain will impose patterns where they don’t exist.
  • In order to turn data into information, you have to understand it.
  • Test your assumptions. Figure out ways to validate what you think you’re seeing.
  • You can’t just install a tool–if you don’t understand what you’re doing, they won’t be helpful.
  • If you do nothing else, download and install AMR Users (assuming your site has more than 2 users)

Where to Learn More

There are online courses and books about becoming a data scientist.  For example:

 

Dec 2015: Making WordPress Easier to Use

This is an expanded version of the “Not Everyone Is a WordPress Expert” talk that I gave at WordCamp Sacramento in November. In it, I cover the developer-client disconnect about the difficulty of WordPress and several approaches we can take to making WordPress more client-friendly.

For the December meetup I added a discussion of Calypso (not yet released at the time of WCSAC) and more in-depth coverage of the Editus plugin from Aesop Interactive. (TL;DR: Calypso is cool but as is won’t be likely to help our clients much, whereas Editus is extremely promising.) I also briefly mentioned the Snowball plugin from the Open HTML Group.

I also had a chance to use Beaver Builder on a real client site, from which I concluded that in most cases this is a tool to make WordPress easier for the people who build the sites than the people we build them for.