proxies and supporting an exploding number of user
play

Proxies and supporting an exploding number of user-accounts Eric - PowerPoint PPT Presentation

Proxies and supporting an exploding number of user-accounts Eric Herman - Percona Live - 2018-04-24 Eric Herman eric.herman@gmail.com https://github.com/ericherman/ https://twitter.com/eric_herman Trend of more complex deployments - tools


  1. Proxies and supporting an exploding number of user-accounts Eric Herman - Percona Live - 2018-04-24

  2. Eric Herman eric.herman@gmail.com https://github.com/ericherman/ https://twitter.com/eric_herman

  3. Trend of more complex deployments - tools ● More external tooling ○ Orchestrator, gh-ost ○ pt-online-schema-change ○ Percona XtraBackup ○ Sqoop, mysql-time-machine ○ ps-top, query analysis tools ○ binlog parsing/analysis tools (e.g. to kafka)

  4. Trend of more complex deployments - plugins ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, e.g. Audit: ○ Prevent CREATE TABLE if no primary key

  5. Trend of more complex deployments - plugins 1 ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, e.g. Audit: ○ Prevent CREATE TABLE if no primary key ■ https://github.com/dveeden/mysql-enforcepk

  6. Trend of more complex deployments - plugins 2 ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, e.g. Audit: ○ Prevent CREATE TABLE if no primary key ■ https://github.com/dveeden/mysql-enforcepk ○ Prevent DROP TABLE if not named like %_DROP_AFTER_YYYY_MM_DD (and past)

  7. Trend of more complex deployments - plugins 3 ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, e.g. Audit: ○ Prevent CREATE TABLE if no primary key ■ https://github.com/dveeden/mysql-enforcepk ○ Prevent DROP TABLE if not named like %_DROP_AFTER_YYYY_MM_DD (and past) ○ Warn if “suspicious” query

  8. Trend of more complex deployments - triggers ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins ● More sophisticated use of triggers ○ Online schema change

  9. Trend of more complex deployments - triggers 1 ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins ● More sophisticated use of triggers ○ Online schema change ○ R&D: write additional information into a blackhole table in order to record more information about “who did it” in the binlog

  10. Trend of more complex deployments - proxies ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, triggers ● More proxies ○ Vitess ○ ProxySQL ○ MySQL Router ○ MaxScale

  11. Trend of more complex deployments - users ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, triggers ● More proxies ● More user accounts per server ○ More applications, services, micro-services ○ More powerful logging, auditing ○ Per-user accounts, fine-grain permissions

  12. Trend of more complex deployments - conflict ● More external tooling (e.g. orchestrator) ● More sophisticated use of plugins, triggers ● More proxies ● More user accounts per server ● Conflict: proxy may not support custom connection attributes, or may not nicely support lots of users with session variables

  13. Wanted: more dynamic connection attributes ● E.g: connection pool with shared app user ○ Set the webpage with each request?

  14. Wanted: more dynamic connection attributes 1 ● E.g: connection pool with shared app user ○ Set the webpage with each request? ● Wish for nicer support at the protocol level ○ But then connector support, too

  15. Wanted: more dynamic connection attributes 2 ● E.g: connection pool with shared app user ○ Set the webpage with each request? ● Wish for nicer support at the protocol level ○ But then connector support, too ● Proxies might use COM_CHANGE_USER ○ Store attributes per proxied connection :-( ○ https://dev.mysql.com/doc/internals/en/com-change-user.html ○ https://mariadb.com/kb/en/library/com_change_user/

  16. Surprise: connect time grows with more users ● Never noticed when a few apps shared a few user accounts ● Noticed slowdown on server with >1000 users ○ Thousands of users is new for me. You?

  17. Surprise: connect time grows with more users 1 ● Never noticed when a few apps shared a few user accounts ● Noticed slowdown on server with >1000 users ○ Thousands of users is new for me. You? ○ https://bugs.mysql.com/bug.php?id=88834 ● Testing showed that slow-down was linear! ○ delay ≅ const_a + (const_b * num_users)

  18. Why a linear slow-down? ● acl_users is a list in RAM ○ This is fast and light for most deployments ○ Has been good-enough for years

  19. Why a linear slow-down? 1 ● acl_users is a list in RAM ○ This is fast and light for most deployments ○ Has been good-enough for years ● But, list is naively traversed in a few places

  20. Why a linear slow-down? 2 ● acl_users is a list in RAM ○ This is fast and light for most deployments ○ Has been good-enough for years ● But, list is naively traversed in a few places ○ 44% time in __strcmp_sse2_unaligned

  21. Why a linear slow-down? 3 ● acl_users is a list in RAM ○ This is fast and light for most deployments ○ Has been good-enough for years ● But, list is naively traversed in a few places ○ 44% time in __strcmp_sse2_unaligned ● Maybe we could use a hashtable?

  22. Hacking a prototype easy, “for real” was tricky ● Subtleties in ACL_USER sorting, candidates ○ Anonymous users ○ Wild-cards in hostnames

  23. Hacking a prototype easy, “for real” was tricky 1 ● Subtleties in ACL_USER sorting, candidates ○ Anonymous users ○ Wild-cards in hostnames ● unorderd_map<string, list<ACL_USER *>> ○ Custom Memory Allocator for PS ○ Tip: avoid allocator constructor arguments

  24. Hacking a prototype easy, “for real” was tricky 2 ● Subtleties in ACL_USER sorting, candidates ○ Anonymous users ○ Wild-cards in hostnames ● unorderd_map<string, list<ACL_USER *>> ○ Custom Memory Allocator for PS ○ Tip: avoid allocator constructor arguments ● https://github.com/mysql/mysql-server/pull/203

  25. Together, let’s make the server better! ● Devs from the whole ecosystem are here: ○ Oracle MySQL ○ MariaDB Server ○ Percona Server ○ Proxies: Vitess, ProxySQL, Spider ○ Individual contributors ● What are your needs? Let’s talk!

  26. Questions?

  27. Thank you

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend