SlideShare una empresa de Scribd logo
1 de 23
MYSQL Handler Socket

              Philip zhong
               5 .10 .2011
Outline
   Why using Handler Socket
   How to build Handler Socket Plug-in
   Handler Socket configuration parameter
   Handler Socket java client program
   Best Practice for java client
   Helpful sites
Why using Handler Socket
item                 with handlesocket          without handlesocket

Process=16 and       QPS:130429                 QPS:95291
request=1000000*16   Mysql server               Mysql server
                     Cpu(s): 29.0%us, 20.6%sy   Cpu(s): 71.2%us, 20.8%sy


Process=32 and       QPS:268294                 QPS:103165
request=1000000*32   Mysql server               Mysql server Cpu(s):
                     Cpu(s): 58.1%us, 27.8%sy   71.1%us, 21.1%sy


Process=64 and       QPS:291960                 QPS:104180
request=1000000*64   Mysql server Cpu(s):       Mysql server Cpu(s):
                     58.8%us, 28.7%sy           71.3%us, 22.3%sy
How to build Handler Socket Plug-in
./autogen.sh
./configure --
   prefix=/home/oracle/mysql5.1.55/lib/mysql/pl
   ugin --with-mysql-source=/package/mysql-
   5.1.55 --with-mysql-
   bindir=/home/oracle/mysql5.1.55/bin --with-
   mysql-
   plugindir=/home/oracle/mysql5.1.55/lib/mysql
   /plugin
make
make install
mysql> install plugin handlersocket soname
 'handlersocket.so';
Handler Socket configuration
          parameter
•   handlersocket_port (default = '9998')
•   handlersocket_port_wr (default = '9999')
•   handlersocket_threads (default = 16, min = 1, max = 3000)
•   handlersocket_threads_wr (default = 1, min = 1, max = 3000)
•   handlersocket_sndbuf (default = 0, min = 0, max = 1677216)
•   handlersocket_rcvbuf (default = 0, min = 0, max = 1677216)
•   handlersocket_readsize (default = 0, min = 0, max = 1677216)
•   handlersocket_wrlock_timeout (default = 12, min = 0, max = 3600)
•   handlersocket_timeout (default = 300, min = 30, max = 3600)
•   open_files_limit = 65535
•   innodb_buffer_pool_size =8G
Handler Socket java client program
Dependent Packages
hs4j-0.1.jar
log4j-1.2.8.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.3.0.jar
Java Key methods(1)
• public HSClientImpl(InetSocketAddress
  inetSocketAddress, int poolSize)
• public IndexSession openIndexSession(String
  dbname, String tableName,String indexName,
  String[] columns)
• public IndexSession openIndexSession(int
  indexId, String dbname,            String
  tableName, String indexName, String[]
  columns)
Java Key methods(2)
• public boolean insert(String[] values)
• public int delete(String[] keys)
• public int delete(String[] keys, FindOperator
  operator)
• public int delete(String[] keys, FindOperator
  operator, int limit,int offset)
• public int update(String[] keys, String[] values,
  FindOperator operator)
Java Key methods(3)
• public int update(String[] keys, String[] values,
  FindOperator operator,int limit, int offset)
• public ResultSet find(String[] keys)
• public ResultSet find(String[] keys,
  FindOperator operator, int limit,int offset)
• public ModifyStatement createStatement()
Create the MYSQL tables
create table mt_data
(
 guid     varchar(18) not null,
 orgid    int(9)   not null,
 tabid    int(9)   not null,
 name      varchar(128) not null,
 IsDeleted char(1) not null,
 createtime datetime not null,
 modifytime datetime not null,
 ....
 primary key(guid,orgid)
) ENGINE=InnoDB CHARSET=utf8;
Java example code fragment
• HSClient hsClient = new HSClientImpl(new
   InetSocketAddress("10.224.56.188", 9999), connectionPoolSize);
• final String[] columns = { "guid", "orgid", "tabid", "name",
"IsDeleted", "createtime", "modifytime", "value0",
"value1", "value2", "value3", "value4", "value5", "value6",
"value7", "value8", "value9", "value10", "value11",
"value12", "value13", "value14", "value15" };
IndexSession session =
   hsClient.openIndexSession("meetingdb","mt_data", "PRIMARY",
   columns);
• Bind values
    final String[] values3 = new String[9];
    values3[0] = guid;
    values3[1] = "1";
     ……
• session.insert(values)
• hsClient.shutdown();
Best Practice for java client
• HSClient is thread-safe, so you must use it as
  SINGLETON object in your application.
• Open index is an expensive operation, so
  reuse an opened index id as much as possible.
• IndexSession is thread-safe,so please reuse an
  opened IndexSession as much as possible.
• Use IndexSession rather than HSClient
• Use ModifyStatement to insert/update data
ModifyStatement example code
ModifyStatement stmt =
  this.session.createStatement();
stmt.setInt(1, 0);
stmt.setString(2, "dennis");
stmt.setInt(4, 27);
stmt.setString(5, "2010-11-28 13:24:00");
stmt.update(keys, FindOperator.EQ);
Helpful sites
• http://code.google.com/p/hs4j/
• http://yoshinorimatsunobu.blogspot.com/201
  0/10/using-mysql-as-nosql-story-for.html
• https://github.com/ahiguti/HandlerSocket-
  Plugin-for-MySQL
Mysql handle socket

Más contenido relacionado

La actualidad más candente

Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Alexey Lesovsky
 
The Ring programming language version 1.6 book - Part 71 of 189
The Ring programming language version 1.6 book - Part 71 of 189The Ring programming language version 1.6 book - Part 71 of 189
The Ring programming language version 1.6 book - Part 71 of 189Mahmoud Samir Fayed
 
Node.js flow control
Node.js flow controlNode.js flow control
Node.js flow controlSimon Su
 
Rop and it's friends
Rop and it's friendsRop and it's friends
Rop and it's friendsnuc13us
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184Mahmoud Samir Fayed
 
Numerical Methods with Computer Programming
Numerical Methods with Computer ProgrammingNumerical Methods with Computer Programming
Numerical Methods with Computer ProgrammingUtsav Patel
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopSages
 
What is row level isolation on cassandra
What is row level isolation on cassandraWhat is row level isolation on cassandra
What is row level isolation on cassandraKazutaka Tomita
 
Data structure programs in c++
Data structure programs in c++Data structure programs in c++
Data structure programs in c++mmirfan
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Ontico
 
Zone.js 2017
Zone.js 2017Zone.js 2017
Zone.js 2017Jia Li
 
Профилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаПрофилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаsamsolutionsby
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopSaša Tatar
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Felix Geisendörfer
 
Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python Hua Chu
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Ontico
 

La actualidad más candente (20)

Prometheus Storage
Prometheus StoragePrometheus Storage
Prometheus Storage
 
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
 
The Ring programming language version 1.6 book - Part 71 of 189
The Ring programming language version 1.6 book - Part 71 of 189The Ring programming language version 1.6 book - Part 71 of 189
The Ring programming language version 1.6 book - Part 71 of 189
 
Node.js flow control
Node.js flow controlNode.js flow control
Node.js flow control
 
Rop and it's friends
Rop and it's friendsRop and it's friends
Rop and it's friends
 
The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184The Ring programming language version 1.5.3 book - Part 25 of 184
The Ring programming language version 1.5.3 book - Part 25 of 184
 
Numerical Methods with Computer Programming
Numerical Methods with Computer ProgrammingNumerical Methods with Computer Programming
Numerical Methods with Computer Programming
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
What is row level isolation on cassandra
What is row level isolation on cassandraWhat is row level isolation on cassandra
What is row level isolation on cassandra
 
Data structure programs in c++
Data structure programs in c++Data structure programs in c++
Data structure programs in c++
 
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
Масштабируемая конфигурация Nginx, Игорь Сысоев (Nginx)
 
Zone.js 2017
Zone.js 2017Zone.js 2017
Zone.js 2017
 
Профилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаПрофилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кода
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Ac2
Ac2Ac2
Ac2
 
All you need to know about the JavaScript event loop
All you need to know about the JavaScript event loopAll you need to know about the JavaScript event loop
All you need to know about the JavaScript event loop
 
Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?Nodejs - Should Ruby Developers Care?
Nodejs - Should Ruby Developers Care?
 
Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python Taipei.py 2018 - Control device via ioctl from Python
Taipei.py 2018 - Control device via ioctl from Python
 
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
Non-Relational Postgres / Bruce Momjian (EnterpriseDB)
 
Jk rubyslava 25
Jk rubyslava 25Jk rubyslava 25
Jk rubyslava 25
 

Destacado

Edtc 6340-66 copyright crash course alberto tudon 6th ed
Edtc 6340-66 copyright crash course  alberto tudon 6th edEdtc 6340-66 copyright crash course  alberto tudon 6th ed
Edtc 6340-66 copyright crash course alberto tudon 6th edalbertotudon
 
Definition of Matter Lab + Phase Change- Day 2
Definition of Matter Lab + Phase Change- Day 2Definition of Matter Lab + Phase Change- Day 2
Definition of Matter Lab + Phase Change- Day 2jmori1
 
Panduan si harka_sebagai_pegawai
Panduan si harka_sebagai_pegawaiPanduan si harka_sebagai_pegawai
Panduan si harka_sebagai_pegawaiWenni Meliana
 
Cso oow12-summit-sonny-sing hv4
Cso oow12-summit-sonny-sing hv4Cso oow12-summit-sonny-sing hv4
Cso oow12-summit-sonny-sing hv4OracleIDM
 
Funcionários públicos foram gratificados para atuar no dops
Funcionários públicos foram gratificados para atuar no dopsFuncionários públicos foram gratificados para atuar no dops
Funcionários públicos foram gratificados para atuar no dopsMiguel Rosario
 
How oracle-uses-idm-chirag-v2
How oracle-uses-idm-chirag-v2How oracle-uses-idm-chirag-v2
How oracle-uses-idm-chirag-v2OracleIDM
 
KVH Whitepaper: Trading in Asia
KVH Whitepaper: Trading in AsiaKVH Whitepaper: Trading in Asia
KVH Whitepaper: Trading in AsiaKVH Co. Ltd.
 
SOP OC COMM
SOP OC COMMSOP OC COMM
SOP OC COMMantiik
 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2hstryk
 
Business Architecture: Overview
Business Architecture: OverviewBusiness Architecture: Overview
Business Architecture: OverviewChris Moloney
 
Social media strategy essentials
Social media strategy essentialsSocial media strategy essentials
Social media strategy essentialsRather Inventive
 
Setting FTP, SSH, NsLookup di linux
Setting FTP, SSH, NsLookup di linuxSetting FTP, SSH, NsLookup di linux
Setting FTP, SSH, NsLookup di linuxRobby Firmansyah
 

Destacado (20)

Edtc 6340-66 copyright crash course alberto tudon 6th ed
Edtc 6340-66 copyright crash course  alberto tudon 6th edEdtc 6340-66 copyright crash course  alberto tudon 6th ed
Edtc 6340-66 copyright crash course alberto tudon 6th ed
 
公共施設白書を知ろう会 資料
公共施設白書を知ろう会 資料公共施設白書を知ろう会 資料
公共施設白書を知ろう会 資料
 
บทที่ 11
บทที่ 11บทที่ 11
บทที่ 11
 
Definition of Matter Lab + Phase Change- Day 2
Definition of Matter Lab + Phase Change- Day 2Definition of Matter Lab + Phase Change- Day 2
Definition of Matter Lab + Phase Change- Day 2
 
อติมา อุ่นจิตร
อติมา  อุ่นจิตรอติมา  อุ่นจิตร
อติมา อุ่นจิตร
 
Panduan si harka_sebagai_pegawai
Panduan si harka_sebagai_pegawaiPanduan si harka_sebagai_pegawai
Panduan si harka_sebagai_pegawai
 
Cso oow12-summit-sonny-sing hv4
Cso oow12-summit-sonny-sing hv4Cso oow12-summit-sonny-sing hv4
Cso oow12-summit-sonny-sing hv4
 
Notam 15-nov-16
Notam 15-nov-16Notam 15-nov-16
Notam 15-nov-16
 
Funcionários públicos foram gratificados para atuar no dops
Funcionários públicos foram gratificados para atuar no dopsFuncionários públicos foram gratificados para atuar no dops
Funcionários públicos foram gratificados para atuar no dops
 
Pres eucome 2016_v3
Pres eucome 2016_v3Pres eucome 2016_v3
Pres eucome 2016_v3
 
How oracle-uses-idm-chirag-v2
How oracle-uses-idm-chirag-v2How oracle-uses-idm-chirag-v2
How oracle-uses-idm-chirag-v2
 
Purely practical data structures
Purely practical data structuresPurely practical data structures
Purely practical data structures
 
KVH Whitepaper: Trading in Asia
KVH Whitepaper: Trading in AsiaKVH Whitepaper: Trading in Asia
KVH Whitepaper: Trading in Asia
 
SOP OC COMM
SOP OC COMMSOP OC COMM
SOP OC COMM
 
Tutorial1 - Part 2
Tutorial1 - Part 2Tutorial1 - Part 2
Tutorial1 - Part 2
 
Business Architecture: Overview
Business Architecture: OverviewBusiness Architecture: Overview
Business Architecture: Overview
 
Social media strategy essentials
Social media strategy essentialsSocial media strategy essentials
Social media strategy essentials
 
Setting FTP, SSH, NsLookup di linux
Setting FTP, SSH, NsLookup di linuxSetting FTP, SSH, NsLookup di linux
Setting FTP, SSH, NsLookup di linux
 
68 avenue Gurgaon 7428424386
68 avenue Gurgaon 742842438668 avenue Gurgaon 7428424386
68 avenue Gurgaon 7428424386
 
บทที่ 4
บทที่ 4บทที่ 4
บทที่ 4
 

Similar a Mysql handle socket

Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨flyinweb
 
Where the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsWhere the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsMatt Warren
 
The Ring programming language version 1.10 book - Part 10 of 212
The Ring programming language version 1.10 book - Part 10 of 212The Ring programming language version 1.10 book - Part 10 of 212
The Ring programming language version 1.10 book - Part 10 of 212Mahmoud Samir Fayed
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsOhad Kravchick
 
(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++Amazon Web Services
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
20160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab0120160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab01Ivan Ma
 
Maintenance for MongoDB Replica Sets
Maintenance for MongoDB Replica SetsMaintenance for MongoDB Replica Sets
Maintenance for MongoDB Replica SetsIgor Donchovski
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptDave Stokes
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite PluginsSveta Smirnova
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSuzquiano
 
Performance and how to measure it - ProgSCon London 2016
Performance and how to measure it - ProgSCon London 2016Performance and how to measure it - ProgSCon London 2016
Performance and how to measure it - ProgSCon London 2016Matt Warren
 
The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202Mahmoud Samir Fayed
 
How to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita GalkinHow to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita GalkinSigma Software
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsUlf Wendel
 

Similar a Mysql handle socket (20)

Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨Nodejs性能分析优化和分布式设计探讨
Nodejs性能分析优化和分布式设计探讨
 
Where the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-OptimisationsWhere the wild things are - Benchmarking and Micro-Optimisations
Where the wild things are - Benchmarking and Micro-Optimisations
 
The Ring programming language version 1.10 book - Part 10 of 212
The Ring programming language version 1.10 book - Part 10 of 212The Ring programming language version 1.10 book - Part 10 of 212
The Ring programming language version 1.10 book - Part 10 of 212
 
Building and Scaling Node.js Applications
Building and Scaling Node.js ApplicationsBuilding and Scaling Node.js Applications
Building and Scaling Node.js Applications
 
(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++(DEV204) Building High-Performance Native Cloud Apps In C++
(DEV204) Building High-Performance Native Cloud Apps In C++
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
20160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab0120160821 coscup-my sql57docstorelab01
20160821 coscup-my sql57docstorelab01
 
Maintenance for MongoDB Replica Sets
Maintenance for MongoDB Replica SetsMaintenance for MongoDB Replica Sets
Maintenance for MongoDB Replica Sets
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Run Node Run
Run Node RunRun Node Run
Run Node Run
 
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScriptJavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
 
Preparse Query Rewrite Plugins
Preparse Query Rewrite PluginsPreparse Query Rewrite Plugins
Preparse Query Rewrite Plugins
 
Hazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMSHazelcast and MongoDB at Cloud CMS
Hazelcast and MongoDB at Cloud CMS
 
Performance and how to measure it - ProgSCon London 2016
Performance and how to measure it - ProgSCon London 2016Performance and how to measure it - ProgSCon London 2016
Performance and how to measure it - ProgSCon London 2016
 
Solr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene EuroconSolr @ Etsy - Apache Lucene Eurocon
Solr @ Etsy - Apache Lucene Eurocon
 
The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202
 
Deep Learning for Computer Vision: Software Frameworks (UPC 2016)
Deep Learning for Computer Vision: Software Frameworks (UPC 2016)Deep Learning for Computer Vision: Software Frameworks (UPC 2016)
Deep Learning for Computer Vision: Software Frameworks (UPC 2016)
 
How to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita GalkinHow to make a high-quality Node.js app, Nikita Galkin
How to make a high-quality Node.js app, Nikita Galkin
 
Scala to assembly
Scala to assemblyScala to assembly
Scala to assembly
 
Built-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIsBuilt-in query caching for all PHP MySQL extensions/APIs
Built-in query caching for all PHP MySQL extensions/APIs
 

Más de Philip Zhong

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignPhilip Zhong
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store Philip Zhong
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip Zhong
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy PatternPhilip Zhong
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_costPhilip Zhong
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guidePhilip Zhong
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guidePhilip Zhong
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012Philip Zhong
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_SystemPhilip Zhong
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuningPhilip Zhong
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compilerPhilip Zhong
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parametersPhilip Zhong
 

Más de Philip Zhong (12)

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store Design
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy Pattern
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_cost
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guide
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guide
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_System
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuning
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compiler
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parameters
 

Último

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Último (20)

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

Mysql handle socket

  • 1. MYSQL Handler Socket Philip zhong 5 .10 .2011
  • 2. Outline  Why using Handler Socket  How to build Handler Socket Plug-in  Handler Socket configuration parameter  Handler Socket java client program  Best Practice for java client  Helpful sites
  • 4.
  • 5. item with handlesocket without handlesocket Process=16 and QPS:130429 QPS:95291 request=1000000*16 Mysql server Mysql server Cpu(s): 29.0%us, 20.6%sy Cpu(s): 71.2%us, 20.8%sy Process=32 and QPS:268294 QPS:103165 request=1000000*32 Mysql server Mysql server Cpu(s): Cpu(s): 58.1%us, 27.8%sy 71.1%us, 21.1%sy Process=64 and QPS:291960 QPS:104180 request=1000000*64 Mysql server Cpu(s): Mysql server Cpu(s): 58.8%us, 28.7%sy 71.3%us, 22.3%sy
  • 6. How to build Handler Socket Plug-in
  • 7. ./autogen.sh ./configure -- prefix=/home/oracle/mysql5.1.55/lib/mysql/pl ugin --with-mysql-source=/package/mysql- 5.1.55 --with-mysql- bindir=/home/oracle/mysql5.1.55/bin --with- mysql- plugindir=/home/oracle/mysql5.1.55/lib/mysql /plugin make make install
  • 8. mysql> install plugin handlersocket soname 'handlersocket.so';
  • 10. handlersocket_port (default = '9998') • handlersocket_port_wr (default = '9999') • handlersocket_threads (default = 16, min = 1, max = 3000) • handlersocket_threads_wr (default = 1, min = 1, max = 3000) • handlersocket_sndbuf (default = 0, min = 0, max = 1677216) • handlersocket_rcvbuf (default = 0, min = 0, max = 1677216) • handlersocket_readsize (default = 0, min = 0, max = 1677216) • handlersocket_wrlock_timeout (default = 12, min = 0, max = 3600) • handlersocket_timeout (default = 300, min = 30, max = 3600) • open_files_limit = 65535 • innodb_buffer_pool_size =8G
  • 11. Handler Socket java client program
  • 13. Java Key methods(1) • public HSClientImpl(InetSocketAddress inetSocketAddress, int poolSize) • public IndexSession openIndexSession(String dbname, String tableName,String indexName, String[] columns) • public IndexSession openIndexSession(int indexId, String dbname, String tableName, String indexName, String[] columns)
  • 14. Java Key methods(2) • public boolean insert(String[] values) • public int delete(String[] keys) • public int delete(String[] keys, FindOperator operator) • public int delete(String[] keys, FindOperator operator, int limit,int offset) • public int update(String[] keys, String[] values, FindOperator operator)
  • 15. Java Key methods(3) • public int update(String[] keys, String[] values, FindOperator operator,int limit, int offset) • public ResultSet find(String[] keys) • public ResultSet find(String[] keys, FindOperator operator, int limit,int offset) • public ModifyStatement createStatement()
  • 16. Create the MYSQL tables create table mt_data ( guid varchar(18) not null, orgid int(9) not null, tabid int(9) not null, name varchar(128) not null, IsDeleted char(1) not null, createtime datetime not null, modifytime datetime not null, .... primary key(guid,orgid) ) ENGINE=InnoDB CHARSET=utf8;
  • 17. Java example code fragment • HSClient hsClient = new HSClientImpl(new InetSocketAddress("10.224.56.188", 9999), connectionPoolSize); • final String[] columns = { "guid", "orgid", "tabid", "name", "IsDeleted", "createtime", "modifytime", "value0", "value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9", "value10", "value11", "value12", "value13", "value14", "value15" }; IndexSession session = hsClient.openIndexSession("meetingdb","mt_data", "PRIMARY", columns); • Bind values final String[] values3 = new String[9]; values3[0] = guid; values3[1] = "1"; …… • session.insert(values) • hsClient.shutdown();
  • 18. Best Practice for java client
  • 19. • HSClient is thread-safe, so you must use it as SINGLETON object in your application. • Open index is an expensive operation, so reuse an opened index id as much as possible. • IndexSession is thread-safe,so please reuse an opened IndexSession as much as possible. • Use IndexSession rather than HSClient • Use ModifyStatement to insert/update data
  • 20. ModifyStatement example code ModifyStatement stmt = this.session.createStatement(); stmt.setInt(1, 0); stmt.setString(2, "dennis"); stmt.setInt(4, 27); stmt.setString(5, "2010-11-28 13:24:00"); stmt.update(keys, FindOperator.EQ);
  • 22. • http://code.google.com/p/hs4j/ • http://yoshinorimatsunobu.blogspot.com/201 0/10/using-mysql-as-nosql-story-for.html • https://github.com/ahiguti/HandlerSocket- Plugin-for-MySQL