veselin word camp-romania-2014
TRANSCRIPT
Lessons from working on WordPress.com
WordCamp Romania 2014
About me
● Veselin Nikolov● @dzver● WordPress.com
About me
● Background as MS SQL DBA
● Currently trying to keep things simple in a team of 10
What happened with the MySQL talk
One month ago
The reception
The questions
● How do I make WordPress secure● What are your tips for secure WordPress● How do I chose save plugins and themes● How do you manage to work remotely?● Are there any other Bulgarians at Automattic?
! MySQL
There are no mistakes,only lessons.
Lesson learned
● Another set of lessons this time and we'll see which one worked better :-)
Story #1 The ID
● 7 year old legacy code● Entire table described in the code● We have items with ids 5 and 6. We need to
add 7.
Story #1 The ID
● One new object● A few helpers● 135 removed magic numbers● One changeset● 0 unit tests
● What could possibly go wrong?
Story #1 Lessons
● Pleasepleaseplease, no magic numbers● Atomic commits, please!● Long functions are hard to understand● Stats monitoring● Legacy is code for which we don't have tests
Story #2 The Notification
● Montreal● 1+ million emails● 1+ million discount coupons (10-ish previously)● Friday
● What could possibly go wrong?
Story #2 The Notification
● Queries that work with small tables:
SELECT * FROM table
SELECT * FROM table ORDER BY whatever
LIMIT 200, 100
Story #2 The Notification
● Queries that don't work with large tables:
SELECT * FROM table
SELECT * FROM table ORDER BY whatever
LIMIT 200, 100
Story #2 The Notification
● Fetching big amounts of data breaks things● Offsetting breaks things● The coupons weren't really used in the past● Repeating millions of anything means a lot of
time
Launching big things on Friday
Offsets
SELECT * FROM ...
WHERE `id` > 1093029
ORDER BY `id` LIMIT 20
SELECT `deadline` FROM ...
WHERE `date` BETWEEN '2014-06-20' AND ...
Offsets
SELECT * FROM ...
WHERE `id` > 1093029
ORDER BY `id` LIMIT 20
SELECT `deadline` FROM ...
WHERE `date` BETWEEN '2014-06-20' AND ...
Offsets
SELECT * FROM `table` JOIN (
SELECT `id` FROM `table`
ORDER BY `whatever`LIMIT 5000,50
) as `b` USING `id`
Story #3 The A/B Test
● A/B test is showing different things to users and measuring effect
● We use Kissmetrics
● We've had 5 different A/B testing classes
Story #3 The A/B Test
● Feature-rich classes● Many levels of abstraction● Expressive names● Many filters and actions
● What could possibly go wrong?
Story #3 The A/B Test
● Wrong results, no one knows why.
Story #3 Lessons Learned
● KISS. Simplest solution worked● Kissmetrics rocks● A/B test everything
Story #4 Barry
<bazza> howdy
<dzver> hi, did I break anything?
<bazza> your blog looks hacked
Story #4
● Unique passwords● 2-factor auth● Come to WordCamp Europe and maybe watch
Barry live :-)
● #praythatbarrycomestowceurope
Summary
● KISS. Simple queries. Simple code.● DRY. Repetition fails.● A/B test. Unit test. Test!
● Launch your next project on Friday at 7pm.
My name is VeselinI code for food.
Ask me anything!