26
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. | What’s New in MySQL 5.7

MySQL Manchester TT - 5.7 Whats new

Embed Size (px)

Citation preview

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

What’s  New  in  MySQL  5.7          

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

Safe  Harbor  Statement  The  following  is  intended  to  outline  our  general  product  direcNon.  It  is  intended  for  informaNon  purposes  only,  and  may  not  be  incorporated  into  any  contract.  It  is  not  a  commitment  to  deliver  any  material,  code,  or  funcNonality,  and  should  not  be  relied  upon  in  making  purchasing  decisions.  The  development,  release,  and  Nming  of  any  features  or  funcNonality  described  for  Oracle’s  products  remains  at  the  sole  discreNon  of  Oracle.  

2  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7  is  GA!  

3  

Enhanced  InnoDB:  faster  online  &  bulk  load  operaNons  

ReplicaNon  Improvements  (incl.  mulN-­‐source,  mulN-­‐threaded  slaves...)  

New  OpNmizer  Cost  Model:  greater  user  control  &  be^er  query  performance  

Performance  Schema  Improvements  

MySQL  SYS  Schema  

Performance  &  Scalability   Manageability  

3  X  Faster  than  MySQL  5.6  

Improved  Security:  safer  iniNalizaNon,  setup  &  management  

NaNve  JSON  Support  

And  many  more  new  features  and  enhancements.  Learn  more  at:  dev.mysql.com  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7  Sysbench  Benchmark:  SQL  Point  Selects                          3x  Faster  than  MySQL  5.6  

       4x  Faster  than  MySQL  5.5   1,600,000  QPS  

0  200,000  400,000  600,000  800,000  

1,000,000  1,200,000  1,400,000  1,600,000  1,800,000  

8   16   32   64   128   256   512   1,024  

Que

ries  p

er  Secon

d  

ConnecHons  

MySQL  5.7:  Sysbench  OLTP  Read  Only  (SQL  Point  Selects)  

MySQL  5.7  

MySQL  5.6  

MySQL  5.5  

Intel(R)  Xeon(R)  CPU  E7-­‐8890  v3  4  sockets  x  18  cores-­‐HT  (144  CPU  threads)  2.5  Ghz,  512GB  RAM  Linux  kernel  3.16  

4  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

                 82%  Faster  than  MySQL  5.6  

0  

20,000  

40,000  

60,000  

80,000  

100,000  

120,000  

8   16   32   64   128   256   512   1,024  

Conn

ect  /  se

c  

ConnecHons  

MySQL  5.7:  Sysbench  OLTP  Read  Only  

MySQL  5.7  

MySQL  5.6  

MySQL  5.5  

Intel(R)  Xeon(R)  CPU  E7-­‐8890  v3  4  sockets  x  18  cores-­‐HT  (144  CPU  threads)  2.5  Ghz,  512GB  RAM  Linux  kernel  3.16  

100K  Connect  /  Sec  

MySQL  5.7  Sysbench  Benchmark:  ConnecNon  Requests    

5  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7  Sysbench  Benchmark:  OLTP  Read  Only                        3x  Faster  than  MySQL  5.6  

       6x  Faster  than  MySQL  5.5            

0  

200,000  

400,000  

600,000  

800,000  

1,000,000  

1,200,000  

8   16   32   64   128   256   512   1,024  

Que

ries  p

er  Secon

d  

ConnecHons  

MySQL  5.7:  Sysbench  OLTP  Read  Only  

MySQL  5.7  

MySQL  5.6  

MySQL  5.5  

Intel(R)  Xeon(R)  CPU  E7-­‐8890  v3  4  sockets  x  18  cores-­‐HT  (144  CPU  threads)  2.5  Ghz,  512GB  RAM  Linux  kernel  3.16  

~  1,000,000  QPS  

6  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7  Sysbench  Benchmark:  OLTP  Read  Write                        1.5x  Faster  than  MySQL  5.6  

       3x  Faster  than  MySQL  5.5  

0  

100,000  

200,000  

300,000  

400,000  

500,000  

600,000  

700,000  

8   16   32   64   128   256   512   1,024  

Que

ries  p

er  Secon

d  

ConnecHons  

MySQL  5.7:  Sysbench  OLTP  Read  Write  

MySQL  5.7  

MySQL  5.6  

MySQL  5.5  

Intel(R)  Xeon(R)  CPU  E7-­‐8890  v3  4  sockets  x  18  cores-­‐HT  (144  CPU  threads)  2.5  Ghz,  512GB  RAM  Linux  kernel  3.16  

7  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  OpNmizer  and  Parser  refactoring  –  Readability,  maintainability  and  stability    –  Separate  parsing,  opNmizing,  execuNon  stages  –  Easier  feature  addiNons,  with  lessened  risk  

•  New  hint  framework  –  Easier  to  manage    – With  support  for  addiNonal  new  hints    

•  Improved  JSON  EXPLAIN  

•  EXPLAIN  for  running  thread  

•  New  Cost  based  OpNmizer  –  Easier  to  extend  –  Configurable  and  tunable  •  mysql.server_cost  and  mysql.engine_cost  tables  •  API  for  where  data  resides:  on  disk  or  in  cache    

•  InnoDB  for  internal  temp  tables    

•  Be^er  ONLY_FULL_GROUP_BY  mode  

•  Many  specific  new  opNmizaNons    

•  Generated  Columns  

MySQL  5.7:  OpNmizer  Improvements    

8  

Queries  execute  faster,  while  using  less  CPU  and  disk  space!  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  Query  Rewrite  Plugin  

• New  pre  and  post  parse  query  rewrite  APIs    – Users  can  write  their  own  plug-­‐ins  • Provides  a  post-­‐parse  query  plugin  – Rewrite  problemaNc  queries  without  the  need  to  make  applicaNon  changes  – Add  hints  – Modify  join  order  – Many  more  …  

•  Improve  problemaNc  queries  from  ORMs,  third  party  apps,  etc  •  Eliminates  many  legacy  use  cases  for  proxies  

9  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  OpNmizer  -­‐  Cost  Info  in  JSON  EXPLAIN    •  Expanded  JSON  EXPLAIN  – Now  includes  all  available  cost  info  – Used  for  Visual  Explain  In  MySQL  Workbench  

{ "query_block": { "select_id": 1, "cost_info": { "query_cost": "200.40" }, "table": { "table_name": "nicer_but_slower_film_list", "access_type": "ALL", "rows_examined_per_scan": 992, "rows_produced_per_join": 992, "filtered": 100, "cost_info": { "read_cost": "2.00", "eval_cost": "198.40", "prefix_cost": "200.40", "data_read_per_join": "852K" }, "used_columns": [ "FID", "title", "description", "category", "price", "length", "rating", "actors" ], ...

10  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  JSON    • NaNve  JSON  data  type  – NaNve  internal  binary  format  for  efficient  processing  &  storage  

• Built-­‐in  JSON  funcNons  – Allowing  you  to  efficiently  store,  search,  update,  and  manipulate  Documents  

•  JSON  Comparator  – Allows  for  easy  integraNon  of  Document  data  within  your  SQL  queries  

•  Indexing  of  Documents  using  Generated  Columns    – InnoDB  supports  indexes  on  both  stored  and  virtual  Generated  Columns  – New  expression  analyzer  automaNcally  uses  the  best  “funcNonal”  index  available  

• New  inline  syntax  for  easy  SQL  integraNon    11  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

Memory  InstrumentaHon  •  Aggregates  staNsNcs  by  –  Type  of  memory  used  (caches,  internal  buffers,  …)  

–  Thread/account/user/host  indirectly  performing  the  memory  operaNon    

•  A^ributes  include    – Memory  used  (bytes)  –  OperaNon  counts  –  High/Low  Water  Marks    

Statement  InstrumentaHon  •  Stored  Procedures    •  Stored  FuncNons  •  Prepared  Statements  

•  TransacNons  

AddiHonal  InformaHon  •  ReplicaNon  slave  status  •  MDL  lock  instrumentaNon  

•  Status  and  variables  per  thread  

•  Server  stage  tracking  •  Track  long  running  SQL  •  Improved  configuraNon  and  ease-­‐of-­‐use  

•  All  while  reducing  total  footprint  and  overhead    

 

MySQL  5.7:  Performance  Schema    

12  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  SYS  Schema    Helper  objects  for  DBAs,  Developers  and  OperaHons  staff  • Helps  simplify  DBA  /  Ops  tasks        -­‐  Monitor  server  health,  user,  host  staNsNcs    -­‐  Spot,  diagnose,  and  tune  performance  issues  •   Easy  to  understand  views  with  insights  into        -­‐  IO  hot  spots,  Locking,  Costly  SQL  statements        -­‐  Schema,  table  and  index  staNsNcs      •  SYS  is  similar  to  -­‐  Oracle  V$  catalog  views  -­‐  Microsot  SQL  DMVs  (Dynamic  Mgmnt  Views)  

  13  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  Replaced  custom  code  with  Boost.Geometry  –  For  spaNal  calculaNons  –  For  spaNal  analysis    –  Enabling  full  OGC  compliance  – We’re  also  Boost.Geometry  contributors!  

•  InnoDB  R-­‐tree  based  spaNal  indexes  –  Full  ACID,  MVCC,  &  transacNonal  support  –  Index  records  contain  minimum  bounding  box  

•  GeoHash  •  GeoJSON  •  Helper  funcNons  such  as  ST_Distance_Sphere()  and  ST_MakeEnvelope()  

MySQL  5.7:  GIS  Improvements    

14  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  NaNve  ParNNoning  –  Eliminates  previous  limitaNons  –  Eliminates  resource  usage  problems  –  Transportable  tablespace  support  

•  NaNve  Full-­‐Text  Search    –  Including  full  CJK  support!  

•  NaNve  SpaNal  Indexes  •  Transparent  page  compression    

•  Support  for  32K  and  64K  pages  –  Use  with  transparent  page  compression  for  very  high  compression  raNos  

•  General  TABLESPACE  support    –  Store  mulNple  tables  in  user  defined  shared  tablespaces    

•  Support  for  MySQL  Group  ReplicaNon  –  High  priority  transacNons  

•  Improved  support  for  cache  preloading  –  Load  your  ho^est  data  loaded  at  startup  

•  Configurable  fill-­‐factor    –  Allows  for  improvements  in  storage  footprint  

•  Improved  bulk-­‐data  load  performance  

•  Resize  the  InnoDB  Buffer  Pool  online      

MySQL  5.7:  InnoDB  Improvements    

15  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  InnoDB  Compression    Thank  you,  SanDisk  Fusion-­‐io    

•  Transparent  Page  Level  Compression  – Happens  transparently  in  background  threads  – Managed  enNrely  within  the  IO  layer  – Uses  sparse  file  and  "hole  punching"  support  in  OS  kernels  and  File  Systems  

• Reduces  IO    – Improves  MySQL  performance  – Improves  storage  efficiency  – Reduces  write  cycles,  thus  increasing  SSD  lifespan  

• Applies  to  all  InnoDB  data,  including  the  system  tablespace  and  UNDO  logs  

16  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  AES  256  EncrypNon  now  the  default  •  Password  rotaNon  policies  –  Can  be  set  globally,  and  at  the  user  level  

•  Deployment:  enable  secure  una^ended  install  by  default  –  Random  password  set  on  install  –  Remove  anonymous  accounts  –  Deployment  without  test  account,  schema,  demo  files  

•  Easier  instance  iniNalizaNon  and  setup:  mysqld  –iniNalize  

•  New  detecNon  and  support  for  systemd    

•  SSL  –  Enabled  by  default  –  Auto-­‐detecNon  of  exisNng  keys  and  certs  –  Auto  generaNon  of  keys  and  certs  when  needed    –  New  helper  uNlity:  mysql_ssl_rsa_setup  –  New  -­‐-­‐require_secure_transport  opNon  to  prevent  insecure  communicaNons  

–  Added  SSL  support  to  binary  log  clients    

•  Extended  Proxy  User  Support  –  Added  Built-­‐in  AuthenNcaNon  Plugins  support  for  Proxy  Users  

–  Allows  mulNple  users  to  share  a  single  set  of  managed  privileges  

 

MySQL  5.7:  Security  Improvements    

17  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  Server-­‐Side  Statement  Timeouts    Thank  you  Davi  Arnaut!  

•  Server  side  statement  Nmeouts  – Global  for  server,  per  session,  or  for  individual  SELECT  statements  

•  Expanded  to  Windows  and  Solaris,  restricted  by  removing  USER  opNon  

 

SELECT /*+ MAX_EXECUTION_TIME(1000) */ * FROM my_table;

18  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  GTID  enhancements  –  On-­‐line,  phased  deployment  of  GTIDs  –  Binary  logging  on  slave  now  opNonal  

•  Enhanced  Semi-­‐synchronous  replicaNon  – Write  guaranteed  to  be  received  by  slave  before  being  observed  by  clients  of  the  master  

–  OpNon  to  wait  on  Acks  from  mulNple  slaves  

•  MulN-­‐Source  ReplicaNon  –  Consolidate  updates  from  mulNple  Masters  into  one  Slave  

•  Dynamic  slave  filters  

•  8-­‐10x  Faster  slave  throughput  –  Oten  removes  slave  as  a  bo^leneck;  keep  pace  with  master  with  8+  slave  threads  

–  OpNon  to  preserve  Commit  order  –  AutomaNc  slave  transacNon  retries  

 

MySQL  5.7:  ReplicaNon  Improvements    

19  

0%#

50%#

100%#

150%#

200%#

250%#

1# 8# 24# 48#Slave#Threads#

Slave#throughput#vs.#96#Thread#Master#

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  5.7:  Enabling  GTIDs    

Check  CompaNbility  

•  Server  reports  any  incompaNble  operaNons  

Generate  GTIDs  

• All  servers  generate  GTIDs  but  don’t  depend  on  them  

Brief  wait  

• Allow  all  legacy  events  to  work  through  all  servers  

GTIDs  Enabled  

• All  Servers  generate  and  expect  GTIDs  only  

•  Full  benefits  of  GTIDs  available  

Phased,  On-­‐line  IntroducHon  

20  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

• MulN-­‐Source  ReplicaNon  – Consolidate  updates  from  mulNple  Masters  into  one  Slave  •  Consolidated  view  of  all  shards  • More  flexible  topologies  •  Centralized  point  for  backups  

– CompaNble  with  Semi-­‐Sync  ReplicaNon  &  enhanced  MTS  

• Performance  Schema  tables  for  monitoring  slave  • Online  OperaNons:  Dynamic  ReplicaNon  Filters,  switch  master  

MySQL  5.7:  ReplicaNon  Improvements  

Slave  

21  

Binlog  

Master  1  

Binlog  

Master  2  

…  

…  

Binlog  

Master  N  

IO  1  

Relay  1  

Coordinator  

W1   W2   …   WX  

IO  2  

Relay  2  

Coordinator  

W1   W2   …   WX  

…  

…  

Coordinator  

W1   W2   …   WX  

IO  N  

Relay  N  

Coordinator  

W1   W2   …   WX  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  Support  for  tracking  session  transacNon  state  – This  offers  be^er  support  for  load  balancing  across  nodes  

•  Server  Version  Tokens  – This  offers  be^er  support  for  caching  in  distributed  systems  

• New  data  migraNon  tool  :  mysqlpump  – Improves  data  migraNon  and  sharding  operaNons  between  nodes  

•  Improved  ReplicaNon  opNons  in  HA  groups  – Improved  slave  performance  with  clock  based  parallelizaNon    – Loss-­‐less  Semi-­‐Sync  ReplicaNon  plugin  supporNng  mulN-­‐node  acks  – Synchronous  replicaNon  (Group  ReplicaNon  plugin  now  in  Labs)  

MySQL  5.7:  High  Availability  Improvements  

Read-­‐slaves  

HA  group  

22  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

•  AcNve/AcNve  Update  Anywhere  –  Conflict  detecNon  and  resoluNon  (transacNon  rollback)  

–  OpNmisNc  State  Machine  ReplicaNon  

•  AutomaNc  group  membership  management  and  failure  detecNon  –  No  need  for  server  fail-­‐over  –  ElasNc  scale  out/in  –  No  single  point  of  failure  –  AutomaNc  reconfiguraNon  

•  Well  integrated  –  InnoDB  –  GTID-­‐based  replicaNon  –  PERFORMANCE_SCHEMA  

MySQL  Group  ReplicaNon    

ApplicaNon  

MySQL  Nodes   ReplicaNon    Plugin  

API  

MySQL  Server  

Group  Comms  

labs.mysql.com  

23  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

• ConnecNon  and  TransacNon  rouNng    •  Transparently  improve  your  MySQL  apps  – Transparent  MySQL  Fabric  support  •  Transparent  HA  •  Transparent  Sharding  

– Transparent  support  for  MySQL  Group  ReplicaNon  clusters  – Transparent  support  for  custom  clusters  and  HA  setups  

•  Easily  extendable  using  plugin  APIs  • Many  new  plugins  to  come  –  AggregaNon,  Binary  Log,  Load  Balancing,  …  

MySQL  Router  

24  

Copyright  ©  2015,  Oracle  and/or  its  affiliates.  All  rights  reserved.    |  

MySQL  Repos  •  DistribuNons  –  Oracle,  Red  Hat,  CentOS    –  Fedora  –  Ubuntu,  Debian  –  SUSE  

•  Official  MySQL  Docker  Image  from  Oracle  

•  Coming  Soon  –  Preconfigured  Containers  –  Improved  support  for  popular  DevOps  deployment  tools  

h^ps://dev.mysql.com/downloads/repo        

MySQL  on  GitHub  •  Git  for  MySQL  Engineering  –  Fast,  flexible  and  great  for  a  distributed  team  –  Great  tooling    –  Large  and  vibrant  community  

•  GitHub  for  MySQL  Community  –  Easy  and  fast  code  availability  to  the  community  and  to  downstream  projects  

–  Pull  Requests    h^ps://github.com/mysql      

 25