Given at zendcon 2007 unconference. My first "talk" ever given. Had a live demo. Note that although some of the information here is still pertinent, a lot is now outdated and most of the links no longer work. This is here for archival reasons
Given at zendcon 2007 unconference. My first "talk" ever given. Had a live demo. Note that although some of the information here is still pertinent, a lot is now outdated and most of the links no longer work. This is here for archival reasons
Toster - Understanding the Rails Web Model and Scalability OptionsFabio Akita
In my first time at Russia, I've presented about Reactor Pattern, Eventmachine, WebSocket and the Pusher service as options for when Rails alone is not enough
"The little big project. From zero to hero in two weeks with 3 front-end engi...Fwdays
It is believed that the front end is only one part of the job. We need a backend to store data, we need some DevOps. Oh, I also forgot about QA. There are legends about titans from the past who could single-handedly draw a design and launch a website.
But here's the real story: we has the Great Idea, it won't work without a back-end, there are only front-end developers in the team, outsourcing is possible only in design, the deadline is too near. Just smile and wave... Or we will can realised the project uses front-end technologies only, cut comlicated things, dive into devops. Spoiler: we did it, the Bobuk-Bacek formula works, JavaScript is power.
You will find out how I Love Front-end was launched, what was cut off by Occam's razor and why everyone hates the Mona Lisa.
Audience and level.
Full-stack developers and front-end developers who want to learn how to make back-end for front-end. Just curious guys. Level from junior to middle.
PECL Picks - Extensions to make your life betterZendCon
One of the biggest strengths of PHP is its "glue" power. Take any C library and with a little magic and a compiler you have a fantastic extension. These extensions hide in PECL, but few people can tell the good from the unmaintained or just plain broken. Find the best extensions for your project, learn about PECL, and find out how to become a part of the PECL developer community.
Video presentation: https://www.youtube.com/watch?v=jLAFXQ1Av50
Most applications written in Ruby are great, but also exists evil code applying WOP techniques. There are many workarounds in several programming languages, but in Ruby, when it happens, the proportion is bigger. It's very easy to write Ruby code with collateral damage.
You will see a collection of bad Ruby codes, with a description of how these codes affected negatively their applications and the solutions to fix and avoid them. Long classes, coupling, misapplication of OO, illegible code, tangled flows, naming issues and other things you can ever imagine are examples what you'll get.
During our most recent workshops, we presented the most popular libraries of Node.js, and their installation on Docker. Thanks to our presentation, you’ll be able to program applications which use Node.js and ES6.
This talk represents the combined experience from several web development teams who have been using Symfony2 since months already to create high profile production applications. The aim is to give the audience real world advice on how to best leverage Symfony2, the current rough spots and how to work around them. Aside from covering how to implement functionality in Symfony2, this talk will also cover topics such as how to best integrate 3rd party bundles and where to find them as well as how to deploy the code and integrate into the entire server setup.
Toster - Understanding the Rails Web Model and Scalability OptionsFabio Akita
In my first time at Russia, I've presented about Reactor Pattern, Eventmachine, WebSocket and the Pusher service as options for when Rails alone is not enough
"The little big project. From zero to hero in two weeks with 3 front-end engi...Fwdays
It is believed that the front end is only one part of the job. We need a backend to store data, we need some DevOps. Oh, I also forgot about QA. There are legends about titans from the past who could single-handedly draw a design and launch a website.
But here's the real story: we has the Great Idea, it won't work without a back-end, there are only front-end developers in the team, outsourcing is possible only in design, the deadline is too near. Just smile and wave... Or we will can realised the project uses front-end technologies only, cut comlicated things, dive into devops. Spoiler: we did it, the Bobuk-Bacek formula works, JavaScript is power.
You will find out how I Love Front-end was launched, what was cut off by Occam's razor and why everyone hates the Mona Lisa.
Audience and level.
Full-stack developers and front-end developers who want to learn how to make back-end for front-end. Just curious guys. Level from junior to middle.
PECL Picks - Extensions to make your life betterZendCon
One of the biggest strengths of PHP is its "glue" power. Take any C library and with a little magic and a compiler you have a fantastic extension. These extensions hide in PECL, but few people can tell the good from the unmaintained or just plain broken. Find the best extensions for your project, learn about PECL, and find out how to become a part of the PECL developer community.
Video presentation: https://www.youtube.com/watch?v=jLAFXQ1Av50
Most applications written in Ruby are great, but also exists evil code applying WOP techniques. There are many workarounds in several programming languages, but in Ruby, when it happens, the proportion is bigger. It's very easy to write Ruby code with collateral damage.
You will see a collection of bad Ruby codes, with a description of how these codes affected negatively their applications and the solutions to fix and avoid them. Long classes, coupling, misapplication of OO, illegible code, tangled flows, naming issues and other things you can ever imagine are examples what you'll get.
During our most recent workshops, we presented the most popular libraries of Node.js, and their installation on Docker. Thanks to our presentation, you’ll be able to program applications which use Node.js and ES6.
This talk represents the combined experience from several web development teams who have been using Symfony2 since months already to create high profile production applications. The aim is to give the audience real world advice on how to best leverage Symfony2, the current rough spots and how to work around them. Aside from covering how to implement functionality in Symfony2, this talk will also cover topics such as how to best integrate 3rd party bundles and where to find them as well as how to deploy the code and integrate into the entire server setup.
DIY: A distributed database cluster, or: MySQL ClusterUlf Wendel
Live from the International PHP Conference 2013: MySQL Cluster is a distributed, auto-sharding database offering 99,999% high availability. It runs on Rasperry PI as well as on a cluster of multi-core machines. A 30 node cluster was able to deliver 4.3 billion (not million) read transactions per second in 2012. Take a deeper look into the theory behind all the MySQL replication/clustering solutions (including 3rd party) and learn how they differ.
ScaleBase Webinar: Scaling MySQL - Sharding Made Easy!ScaleBase
Home-grown sharding is hard - REALLY HARD! ScaleBase scales-out MySQL, delivering all the benefits of MySQL sharding, with NONE of the sharding headaches. This webinar explains: MySQL scale-out without embedding code and re-writing apps, Successful sharding on Amazon and private clouds, Single vs. multiple shards per server, Eliminating data silos, Creating a redundant, fault tolerant architecture with no single-point-of-failure, Re-balancing and splitting shards
MySQL Proxy. A powerful, flexible MySQL toolbox.Miguel Araújo
MySQL-Proxy is a software application that, as the name suggests, sits between your client and MySQL server(s) allowing you to monitor, analyse or transform that communication. It communicates over the network using the MySQL network protocol and as so, in its the most basic configuration, Proxy simply interposes itself between the server and clients, passing queries from the client to the server and its responses on the other way around. This opens the possibility of changing the communication packets when needed, allowing thus being used for multiple purposes being the most remarkable query analysis, query filtering and modification, load balancing, failover, query injection and pooling.
On this session I'll present and give you a global overview of MySQL-Proxy and the concepts behind it. Use-cases, technical overview and architecture will follow. And of course, everyone will want to see it working so that'll be included as well in parallel with detailed explanation on how you can use it to fulfill your needs.
This presentation is designed to assist Developers, Architects and DBAs in navigating the complex waters of HA. It presents:
- Methodology for selecting the right HA solution to meet SLAs;
Tour of the leading certified HA solutions for MySQL;
Operational best practices to implement and support HA.
A tutorial on MySQL High Availability on the Pacemaker stack. Covers both MySQL on DRBD, and MySQL with MySQL replication.
Presented by Florian Haas and Yves Trudeau at the Percona Live MySQL Conference & Expo, 2012
Clustering MySQL is a mainstream technology to handle todays web loads. Regardless whether you choose MySQL Replication, MySQL Cluster or any other type of clustering solution you will need a load balancer. PECL/mysqlnd_ms 1.4 is a driver integrated load balancer for PHP. It works with all APIs, is free, semi-transparent, at the best possible layer in your stack and loaded with features. Get an overview of the latest development version 1.4.
MySQL 5.6 Global Transaction IDs - Use case: (session) consistencyUlf Wendel
PECL/mysqlnd_ms is a transparent load balancer for PHP and MySQL. It can be used with any kind of MySQL Cluster. If used with MySQL Replication it has some tricks to offer to break out of the default eventual consistency of the lazy primary copy design of MySQL Replication. It is using global transaction ids to lower read load on the master while still offering session consistency. Users of MySQL 5.6 can use the server built-in global transaction id feature, everybody else can use the driver built-in emulation that works with previous MySQL versions as well. Of course, its a mysqlnd plugin and as such it works with all PHP MySQL APIs (mysql, mysqli, PDO_MySQL). Happy hacking!
MySQL High Availability and Disaster Recovery with Continuent, a VMware companyContinuent
Users seeking high availability, disaster recovery and zero downtime maintenance operation for business-critical MySQL applications face confusing choices. Is multi-master or master/slave clustering better? What about synchronous versus asynchronous replication? Using a plain vanilla, stock MySQL or a modified version of it? Which of these choices are right for data-driven businesses that depend on fast, reliable data access?
This no-BS webinar cuts through the FUD to explore the real trade-offs between the different clustering and replication methods, thens show you how Continuent's asynchronous master/slave clusters support these important capabilities for business-critical applications:
- High application write rates Master/slave clustering with Continuent
- Mixed workloads consisting of large and small transactions
- Data across multiple geographically distributed locations
- Failures and more importantly recovery from them
- Zero downtime maintenance and software upgrades
- Use of off-the-shelf MySQL/MariaDB to avoid application changes and allow clusters to improve as MySQL itself does.
We illustrate key points with demonstrations and case studies from deployed systems.
MySQL Fabric is an open-source framework for the management of farms of servers. It is designed to be easy to use and available for both small and large server farms.
In order to create a solution that is truly resilient to failures, it is necessary to ensure redundancy of every component in the system and have a solid foundation for detecting and handling failures.
In this session, you will learn how to build a robust
high-availability solution using MySQL Fabric, what components you need and how they should be set up. You will learn how MySQL Fabric handles high-availability of the application servers and how to ensure high-availability of the Fabric system as a whole. You will also learn how to leverage, for example, OpenStack to ensure that the system keeps operating in the presence of failures.
MySQL Replication: What’s New in MySQL 5.7 and BeyondAndrew Morgan
Continuing in the footsteps of its predecessor, MySQL 5.7 is set to be a groundbreaking release. In this webinar, the engineers behind the product provide insights into what’s new for MySQL replication in the latest 5.7 Development Milestone Release and review the early access features available via labs.mysql.com. The next generation of replication features cover several technical areas such as better semi-synchronous replication, an enhanced multithreaded slave (per-transaction parallelism), improved monitoring with performance schema tables, online configuration changes, options for fine-tuning replication performance, support for more-advanced topologies with multisource replication, and much more. This is also a great chance to learn about MySQL Group Replication – the next generation of active-active, update-anywhere replication for MySQL.
ProxySQL - High Performance and HA Proxy for MySQLRené Cannaò
High Availability proxy designed to solve real issues of MySQL setups from small to very large production environments.
Presentation at Percona Live Amsterdam 2015
Using MySQL Fabric for High Availability and Scaling OutOSSCube
MySQL Fabric is an extensible framework for managing farms of MySQL Servers. In this webinar, you will learn what MySQL Fabric is, what it can achieve and how it is used by database administrators and developers. Plus, you will learn how MySQL Fabric can help for sharding and high-availability. See more @ http://www.osscube.com/
Troubleshooting tips from docker support engineersDocker, Inc.
Docker makes everything easier. But even with the easiest platforms, sometimes you run into problems. In this session, you'll learn first-hand from someone whose job is helping customers fix these problems. In this session, you'll learn how to:
Ask better questions & identify the real problems you want to solve
Use command line tools to inspect internal Swarm and Kubernetes components
Debug and troubleshoot interactions between Enterprise Edition components
Troubleshoot Docker Enterprise Edition Windows nodes
Apply these skills to troubleshooting Docker Enterprise Edition
Those days, when it seemed, that web applications have overthrown standard “cumbersome” client apps, we’ll speak about present and future of consumer oriented desktop applications. This includes, but not restricted to patterns of LOB applications development with WPF, right multimedia support of DirectX bridge and new features, waiting for you in Windows 7. Also we’ll speak about subject oriented programming, will be introduced in NET. 4.0 and how to leverage it even today with the current version of Microsoft framework. tits will be shown during the session, thus restricted to mature audiences
PHP classes in mumbai, Introduction to PHP/MYSQL..
best PHP/MYSQL classes in mumbai with job assistance.
our features are:
expert guidance by IT industry professionals
lowest fees of 5000
practical exposure to handle projects
well equiped lab
after course resume writing guidance
For more Visit: http://vibranttechnologies.co.in/php-classes-in-mumbai.html or http://phptraining.vibranttechnologies.co.in
Through the magic of virtualization technology (Vagrant) and Puppet, a companion Enterprise grade provisioning technology, we explore how to make the complex configuration game a walk in the park. Bring new team members up to speed in minutes, eliminate variances in configurations, and make integration issues a thing of the past.
Welcome to the new age of team development!
PHP / MySQL applications are compatible to all operating systems, support all the popular databases, 100% remotely configurable, perfect for web programming & provide higher performance and speed.
PHP is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dynamically generated pages quickly.
MySQL is a Relational Database Management System (RDBMS) that uses Structured Query Language (SQL).
PHP is the most popular scripting language for web development. It is free, open source and server-side (the code is executed on the server).
PHP third party tool and plug-in integration such as chat, forum, blog and search engine
Try to imagine the amount of time and effort it would take you to write a bug-free script or application that will accept a URL, port scan it, and for each HTTP service that it finds, it will create a new thread and perform a black box penetration testing while impersonating a Blackberry 9900 smartphone. While you’re thinking, Here’s how you would have done it in Hackersh:
“http://localhost” \
-> url \
-> nmap \
-> browse(ua=”Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+”) \
-> w3af
Meet Hackersh (“Hacker Shell”) – A new, free and open source cross-platform shell (command interpreter) with built-in security commands and Pythonect-like syntax.
Aside from being interactive, Hackersh is also scriptable with Pythonect. Pythonect is a new, free, and open source general-purpose dataflow programming language based on Python, written in Python. Hackersh is inspired by Unix pipeline, but takes it a step forward by including built-in features like remote invocation and threads. This 120 minute lab session will introduce Hackersh, the automation gap it fills, and its features. Lots of demonstrations and scripts are included to showcase concepts and ideas.
Ansible is a Configuration Management System that is very simple to use, because of its straightforward and robust model for managing automation and it’s low barrier to entry for ease of use in both development and production.
During OpenStack development, Ansible can be used in conjunction with Vagrant and Devstack to manage complex, multi-node development environments with relative ease.
In this presentation, Juergen Brendel and David Lapsley review Ansible and provide some sample playbooks to get developers up and running quickly. They also describes how to use Ansible, Vagrant, Devstack, and OpenStack to accelerate OpenStack development cycles.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Let's dive deeper into the world of ODC! Ricardo Alves (OutSystems) will join us to tell all about the new Data Fabric. After that, Sezen de Bruijn (OutSystems) will get into the details on how to best design a sturdy architecture within ODC.
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Key Trends Shaping the Future of Infrastructure.pdf
MySQL Proxy tutorial
1. MySQL Proxy
The complete tutorial
Jan Kneschke,
Presented by,
MySQL AB® & O’Reilly Media, Inc.
Senior software Engineer,
MySQL
Giuseppe Maxia,
Community Team Leader,
MySQL
This work is licensed under the Creative Commons Attribution-Share Alike 3.0
Unported License.
2. Raise your hand
Who has heard of MySQL Proxy ?
Who has tried out MySQL Proxy ?
Who runs MySQL Proxy in production ?
Who wrote scripts for MySQL Proxy ?
Who runs MySQL Proxy from svn ?
Who runs another MySQL Proxy like
application ?
3. Raise your hand
Who has read the quot;getting startedquot;
article?
Who has read the datacharmer blog
posts?
4. Agenda
Overview
Basic principles
Lua scripts
Proxy for a single backend
Proxy for multiple backends
Wizardry (all over)
5. Proxy (< latin quot;procuratioquot;)
= Someone taking care of someone
else's interests
A server proxy is something acting on
behalf of another server
7. Proxies for http
Squid, Varnish, ...
SSL Off-Loading in hardware
perlbal
DNS round robin
8. And for MySQL?
Load Balancing for Scale Out
Fail Over on Maintenance, Host Failure, ...
Tracing of Evil Queries
Patching Evil Queries
Connection Pooling
9. Proxies for MySQL
no MySQL awareness
• tcp-level solutions
not transparent
• Continuent(tm) uni/cluster
• sqlrelay
around 2007
• home grown solutions
10. Grow your own
REST to SQL (nytimes)
• uses HTTP features
MySQL transparent
• Protocol in the forge
• implement server and client side
• MySQL Proxy, dormando, DBI::MySQLServer
18. what can you do with MySQL Proxy
create new commands
filter queries (deny specific queries)
collect statistics on usage
implement usage quotas
execute shell commands
create customized logs
implement server-side pivot tables
start/stop a MySQL server remotely
19. what can you do with MySQL Proxy
play movies (seriously!)
make coffee (really?)
sharding
load balancing servers
20. what can you do with MySQL Proxy
Let us show you ...
33. working with results
• return the original result
• return a fake result
• return an error
• alter the original result
• return something different
(affected/retrieved)
34. debugging
• Put a Proxy in between
• use a sensible script to see
what's going on (e.g.
tutorial-packets.lua or
tutorial-states.lua)
35. debugging
server
proxy
client
diagnostics
text
44. Numbers and strings
• nil = no value (false)
• number = floating point
• '5' =/= 5 a = nil
b = 5; c = '5'
print (b == c)
false
print (b == c +0)
true
45. Numbers and strings
• conversion on demand
a = 5 ; b = '5'
print(type(a), type(b))
number string
print(type(b+0))
number
print(type(a .. quot;quot;))
string
46. Numbers and strings
• conversion on demand
a = 5 ; b = '5'
print(type(tostring(a)))
string
print(type(tonumber(b)))
number
47. strings
• smart quoting
a = 'Hello'
b = quot;Worldquot;
c = quot;Can'tquot;
d = [[Don't say quot;Helloquot;]]
e = [=[quot;d'ohquot; [[braces]]!]=]
48. tables
• associative arrays
• can be used as arrays
• can create complex structures
t1 = {10, 20, 30 }
t2 = {
a = 'abc',
b = 2,
c = { 3, 4}
}
49. functions
• can be assigned to variables
• new functions can override existing
ones
function f (x)
print(x)
end
g=f
g(10)
50. userdata
• containers to exchange data
between Lua and host language
• can have quot;tag methodsquot;
53. statement blocks
• if
if condition then
statements
end
• while
while condition do
statements
end
54. statement blocks
• for
for var = 1, 10 [,step] do
statements
end
• for
for n,v in pairs(table_var) do
statements
end
55. sample function
• read_query
1 function read_query(packet)
2 if packet:byte() ~=
3 proxy.PROXY_COM_QUERY
4 then
5 return
6 end
7 local query = packet:sub(2)
8 print('received ' .. query)
9 end
56. some details
== equals
~= not equal
string.byte(packet)
packet:byte()
string.sub(packet,2)
packet:sub(2)
'abc' .. '123' == 'abc123'
57. using tables
t = {}
t[1] = 'a' --First element 1, ! 0
t[2] = 'b'
table.insert(t, 'c')
-- or t[ #t +1 ] = 'c'
t = {'a', 'b', 'c' }
t = {1 = 'a', 2 = 'b', 3 = 'c'}
print (t[2])
b
58. using tables
sizes = {}
sizes['john'] = 'XL'
sizes['paul'] = 'M'
sizes['fred'] = 'L'
sizes = {
john = 'XL',
paul = 'M',
fred = 'L',
}
59. using tables
sizes = {
john = 'XL',
paul = 'M',
fred = 'L',
}
print(sizes['john'])
XL
print(sizes.paul)
M
60. using tables
for i, v in ipairs(t) do
print (i ..' -> ' .. v)
end
for name,size in pairs(sizes) do
print(name .. ' ' ..
'wears' .. ' ' ..
size)
end
61. WATCH OUT!
/* C / C++ */
int a = 0;
printf(quot;%snquot;,
a ? quot;truequot; : quot;falsequot;);
false
-- Lua
a=0
print ( a and quot;truequot; or quot;falsequot;)
true
62. WATCH OUT!
-- Lua
a = false
print ( a and quot;truequot; or quot;falsequot;)
false
a = nil
print ( a and quot;truequot; or quot;falsequot;)
false
63. Finding text
query = 'SELECT id FROM t1'
local cmd, column =
query:match(quot;(SELECT)%s+(%w+)quot;)
if cmd then
-- do something with query
end
64. finding text
• Regular expressions
• similar to Perl/PHP, but simpler
• % instead of
• (captures)
• [character classes]
• ^$+-?*
• no alternation (a|b)
• no modifiers /i
65. finding text (Proxy way)
local tk =
require('proxy.tokenizer')
local tokens = tk.tokenize(query)
if tokens[1].token_name ==
'TK_SQL_SELECT' then
-- do something with query
end
66. finding text (Proxy way)
-- each token is a table
token = {
token_name = 'TK_SQL_SELECT',
text = 'select',
token_id = 204
}
67. I/O
-- files are objects
local fname = '/tmp/test.txt'
assert(fh = io.open(fname,'r'))
for line in fh:lines() do
print(line)
end
fh:close()
68. I/O
-- files are objects
local fname = '/tmp/test.txt'
assert(fh = io.open(fname,'w'), 'oops!')
for x = 1, 100 do
fh:write('new row ' .. x)
fh:flush()
end
fh:close()
73. cookbook: returning a full dataset
function make_dataset (header, dataset)
proxy.response.type = proxy.MYSQLD_PACKET_OK
proxy.response.resultset = {
fields = {}, rows = {}}
for i,v in pairs (header) do
table.insert(
proxy.response.resultset.fields,
{type = proxy.MYSQL_TYPE_STRING, name = v}
end
for i,v in pairs (dataset) do
table.insert(proxy.response.resultset.rows, v )
end
return proxy.PROXY_SEND_RESULT
end
74. cookbook: returning a full dataset
return make_dataset(
{'command', 'description' }, -- the header
{ -- the rows
{'FOO', 'removes the database'},
{'BAR', 'drops all tables'},
{'FOOBAR', 'makes the server explode'},
}
)
78. cookbook: returning a non dataset result
function affected_rows (rows,id)
proxy.response = {
type = proxy.MYSQLD_PACKET_OK,
affected_rows = rows,
insert_id = id,
}
return proxy.PROXY_SEND_RESULT
end
80. cookbook: debug messages
local DEBUG = os.getenv('DEBUG') or 0
DEBUG = DEBUG + 0
function read_query (packet )
if packet:byte() ~= proxy.COM_QUERY then return end
print_debug(packet:sub(2),1)
print_debug('inside read_query', 2)
end
function print_debug(msg, level)
level = level or 1
if DEBUG >= level then
print (msg)
end
end
81. cookbook: verbose level at run time
local DEBUG = os.getenv('DEBUG') or 0
DEBUG = DEBUG + 0
function read_query (packet )
if packet:byte() ~= proxy.COM_QUERY then return end
local vlevel=query:match('^VERBOSE=(%d)$')
if vlevel then
DEBUG = vlevel+0
return simple_dataset('verbose',vlevel)
end
end
82. cookbook: keep info inside a session
proxy
script
my variable value
my variable value my variable value
83. cookbook: keep info inside a session
nothing to do :)
Proxy scripts have session scope by default
local tot_q = 0
function read_query (packet )
if packet:byte() ~= proxy.COM_QUERY then return end
tot_q = tot_q + 1
print('queries ' .. tot_q)
end
85. cookbook: share info among sessions
proxy.global.tot_q = proxy.global.tot_q or 0
function read_query (packet )
if packet:byte() ~= proxy.COM_QUERY then return end
proxy.global.tot_q = proxy.global.tot_q + 1
print('queries ' .. proxy.global.tot_q)
end
90. all_hooks.lua
source: 010_all-hooks.lua
function read_query (packet)
print_access('inside read_query t' .. packet:sub(
proxy.queries:append(1, packet)
return proxy.PROXY_SEND_QUERY
end
function read_query_result (inj)
print_access('inside read_query_result t' ..
inj.query)
end
91. read_query and read_query_result
client
query
result
function
read_query_result
function MySQL
read_query Proxy
if a query is passed directly to the
query
server, its result is NOT evaluated
result
by read_query_result
SERVER
92. read_query and read_query_result
client
query
result
function
read_query_result
MySQL
function
only if a query is
Proxy
read_query
added to the query
query queue
queue, its result is
query
query
query
evaluated by
result
read_query_result
SERVER
98. Q&A
Let's talk!
Slides and example scripts
http://datacharmer.org/tutorial_uc2008/
This work is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License. To view a copy of this
license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite
300, San Francisco, California, 94105, USA.