《加快 MySQL 應用程序開發.pdf》由會員分享,可在線閱讀,更多相關《加快 MySQL 應用程序開發.pdf(60頁珍藏版)》請在三個皮匠報告上搜索。
1、Faster Application Development for MySQLCopyright 2024 Oracle and/or its affiliates1Mike Frank,MySQL Product Management Director|OracleOracleStreamlining Software development can be complicatedDevelopers strive to deliver high-quality products faster and more efficientlyStreamlining for Creating,Des
2、igning and Testing software requiresSimplificationAutomationOptimizationIn this talk we will present new techniques for”Streamlining”AppDev with MySQL”Copyright 2024 Oracle and/or its affiliates2Streamlining development for MySQLCopyright 2024,Oracle and/or its affiliates.All rights reserved.31-Inte
3、gration with VS Code for MySQL Devs and DBAsSQL IDE for MySQLMySQL Shell Extension for VS CodeSupport SQL,JavaScript,PythonAdmin APIsConnectionsMySQL HeatWave and OCI Integration2-Leverage Progressive Web Apps using RESTMySQL Restful Service within the MySQL RouterAutomate using create from a schema
4、Integration to develop to RestAPIs within VS Code3-Supporting JavaScript dev inside the MySQL server Write MySQL Stored ProceduresDevelop,debug and and deploy within VS Code4-MySQL Kubernetes OperatorAutomatesDeploymentConfigurationAvailabilityConsistent environment for development,testing,and produ
5、ctionAllows developers to focus on codeOverviewCopyright 2024,Oracle and/or its affiliates.All rights reserved.41-Integration with VS Code for MySQL Devs and DBAsVS Code IDEExtensionsMulti-languageMulti-platformSource Code Control IntegrationWith MySQL Shell ExtensionSchema NavigationSQL EditorSQL W
6、orksheetsData/Results GridsOCI integrationCopyright 2024 Oracle and/or its affiliates52-Leverage Progressive Web Apps using RESTAdvantages PWAs are platform agnostic same code across multiple platformsLeverages Web Dev SkillsFaster DevelopmentDiscoverableSecurity Standards supportedEasy to updateCop
7、yright 2024 Oracle and/or its affiliates6“Progressive Web Apps are just web applications.Using progressive enhancement,new capabilities are enabled in modern browsers.Using service workers and a web app manifest,your web application becomes reliable and installable.If the new capabilities arent avai
8、lable,users still get the core experience”https:/web.dev/articles/what-are-pwas3-Supporting JavaScript dev inside the MySQL server Execute JavaScript Stored Programs and Stored Functions via GraalVMJust like SQL Stored Programs,but now with Improved Developer ExperienceSecurity at its coreState-of-t
9、he-art optimizationsDesigned for both Cloud Service and on-premiseAvailable Now!MySQL Heatwave Database Service for OCI,AWS and AzurePreview of MySQL Enterprise Edition on Oracle Technology Network(OTN).Copyright 2024 Oracle and/or its affiliates74-MySQL Kubernetes OperatorCopyright 2024 Oracle and/
10、or its affiliates8Orgs haveMany machinesMany workloadsNeed to manage those efficientlySo developers can just focus on high value appdevNeed to hide complexityDevelopers just want MySQL servers accessible via some host and port(IP/port)Kubernetes solutionA portable,extensible platform for managing co
11、ntainerized workloads and servicesFacilitates both declarative configuration and automation DetailsCopyright 2024,Oracle and/or its affiliates.All rights reserved.91-Integration with VS Code for MySQL Devs and DBAsCopyright 2024 Oracle and/or its affiliates10VS Code for MySQL Shell11Copyright 2024 O
12、racle and/or its affiliatesNext generation UI/Dev platformVS Code Extension-MySQL ShellSuccessor to MySQL WorkbenchIDE for MySQL DBAs and DevelopersKey Features12Copyright 2024 Oracle and/or its affiliatesSQL EditorSQL WorksheetsSchema NavigationData/Results GridsJavaScript and TypeScriptEditorsQuer
13、y,manipulate,and visualize your data.Integrates seamlessly into your development workflow.OCI MySQL Heatwave Service IntegrationInstall VS CodeDownload Run installerStart VS CodeCopyright 2024 Oracle and/or its affiliates13https:/ the MySQL Shell ExtensionCopyright 2024 Oracle and/or its affiliates1
14、4Connect-OCI MySQL HeatWave Connection Copyright 2024 Oracle and/or its affiliates15As Developer,the easiest way to connect to your MySQL DB System if you dont have any VPN to your OCI tenancy,is to use the Bastion Service:The right tools for AppDevs and DBAsCopyright 2024 Oracle and/or its affiliat
15、es16Copyright 2024 Oracle and/or its affiliates17Connection Configuration WizardEasily create,test,and save connectionsStore passwords securely to key vaults/ringsSupports SSH tunneling and OCI Bastion serviceMySQL Server StatusCopyright 2024 Oracle and/or its affiliates18Copyright 2024 Oracle and/o
16、r its affiliates19Database Object BrowserQuick FindCopyright 2024 Oracle and/or its affiliates20OCI HeatWave IntegratedMigrate to HeatWaveCopyright 2024 Oracle and/or its affiliates21Run scriptsGenerate SQLIntellisenseCopyright 2024 Oracle and/or its affiliates22MySQL NotebooksAllows devs to integra
17、te code,text,equations,and visualizations In a single document known as a“notebook.”ScriptSQLJavaScriptTypescriptMySQL ShellVS Code Notebook API allowed the MySQL Visual extension to Open files as notebooks,Execute notebook code cells Render notebook outputs in a variety of rich and interactive form
18、atshttps:/ 2024 Oracle and/or its affiliates23Creating a DB ConnectionRescale HA Load DataTrace Execution Errors2-Leverage Progressive Web Apps using RESTCopyright 2024 Oracle and/or its affiliates24Rapidly develop PWAs using RESTful Web ServicesRestful Web ServicesRestful Web ServicesAutomates crea
19、tion of REST for tables,views,and proceduresJSON responsesDeveloper support(GUI,CLI,API)MySQL Shell for VS CodeMySQL Shell for VS CodeGUI frontend for MySQL Rest Service managementInteractive documentationCLI and scripting supportBuilt in User ManagementBuilt in User ManagementSupport for popular OA
20、uth2 servicesUser Role,Group&Hierarchy ManagementUser Management UICopyright 2024 Oracle and/or its affiliates25High Level ArchitectureCopyright 2024 Oracle and/or its affiliates26Fast and secure HTTPS access to your MySQL data.Implemented as a MySQL Router featureSimple to configurationFull UI inte
21、gration with VS Code for MySQLIdeally suited for Progressive Web AppsHighly available and scalableMySQL Restful Service Overview27Copyright 2024 Oracle and/or its affiliatesWorks with all popular MySQL Deployment Models Cloud-MySQL HeatWave On premises-MySQL InnoDB Cluster Set,Replica Set,MySQL Rout
22、er Serves JSON data via RESTful Web ServicesCopyright 2024 Oracle and/or its affiliates28Steps 1.Configure MySQL Instance for Rest2.Add schema to Rest3.Add database objects to the service Auto REST for tables,views and procedures4.Manage Rest Objects123Mapping JSON/Relational Duality Via Rest Servic
23、eCopyright 2024 Oracle and/or its affiliates29MappingCopyright 2024 Oracle and/or its affiliates30ManageStart/StopEnable/DisableRouter Service ManagementBootstrapConfigureStartStopKillIntegrated documentationCopyright 2024 Oracle and/or its affiliates31Rest Shortcuts Copy Open Dump RemoveBrowse via
24、RestCopyright 2024 Oracle and/or its affiliates32TypeScript integration33Copyright 2024 Oracle and/or its affiliatesTypeScript JavaScript With Syntax For Types VS code for MySQL can report errors when the types dont matchIntegration allows interactive execution of TypeScript code inside a DB Noteboo
25、k.Makes working with the MySQL REST Service easier Is available within the DB NotebooksRESTful development specific TypeScript SDK is updated in real time as REST service involves Allows instant prototyping of REST queries using the Client API inside VS CodeData driven application developmentQuery b
26、uilder support to read and write dataLoved by developersIntuitiveAutomatedType safeAutocompleteView resultsCopyright 2024 Oracle and/or its affiliates34REST APIs forCopyright 2024 Oracle and/or its affiliates35https:/ by exampleIncludes PWA demo app Copyright 2024 Oracle and/or its affiliates36Showc
27、ases features Of the MySQL REST ServiceDeployed directly From with VS Code Upload and serve the applicationUsing MySQL Routers3-Supporting JavaScript dev inside the MySQL server Copyright 2024 Oracle and/or its affiliates37JavaScript applications with MySQLJavaScript Applications are popularPowerful
28、 for light weight front-end and server-side applicationsHandles data-intensive use casesData ValidationJSON&String processing/FormattingData Cleansing/TransformationMinimize data movement between server and clientsCopyright 2024 Oracle and/or its affiliates38Streamline using Procedural programs insi
29、de DatabaseCopyright 2024 Oracle and/or its affiliates39Data-intensive app functionality inside the database serverHandleData movementMinimizeCostReduceSecurityImproveETL(Extract,Transform,and Load)to simpler ELT(Extract,Load,Transform)data pipelines-the modern data warehouse approachSimplifyMySQL S
30、tored Programs-SQL vs JavaScriptCopyright 2024 Oracle and/or its affiliates40SQL Stored ProceduresJavaScriipt Stored ProgramsExpressivenessHard to use,lacks basic constructs like containers(arrays,maps)Highly expressive and robustEfficiencyChallenging to optimize due to interpreted codeMany JS code
31、analysis tools.JavaScript apps are fast and optimized by GraalVMEcosystemInsufficient:Lacks support from IDEs,debuggers,testing frameworks,Massive ecosystem of tools for developers of JavaScript applicationsAvailability of developersFew experienced programmersEspecially with MySQL Ecosystem13.8 M De
32、velopersThe most popular developer languageReusable 3rd Party librariesFew,mostly code examplesThousandsJavaScriptUbiquitousOne of the most used language by developers*98%of all web pages use JavaScript*Multiple RuntimesSupport in all major web browsersMassively used server-side runtimesNode.js Deno
33、Development Eco-systemNpm contains 2 million free to use JavaScript packages*10 million users use the npm package managerCopyright 2024 Oracle and/or its affiliates41*Stack Overflow 2024 survey*https:/ JavaScript stored programsSimple SyntaxLANGUAGE clause now allows JavaScriptString quoting mechani
34、sm to enclose non-SQL languageAS$.$AS$JavaScript$.$JavaScript$Function EnvironmentNo function redefinition in JavaScript requiredSQL argument identifiers directly available in JavaScriptAuto Type-ConversionTransparent MySQL JavaScript type conversionSupports all variations of INT,FLOATS,DATETIME,VAR
35、CHAR(utf8mb4)Copyright 2024 Oracle and/or its affiliates42CREATE FUNCTION gcd_js(a INT,b INT)RETURNS INT LANGUAGE JAVASCRIPT AS$let x,y=Math.abs(a),Math.abs(b);while(y)x,y=y,x%y;return x;$JavaScript inside SQLSELECTUse anywhere where SQL stored functions can be usedExpressions,Projection,WHERE claus
36、e,GROUP-BY,JOIN,ORDER BY,HAVING etc.DMLs,DDLs,VIEWsSupport inside DMLs(INSERT,UPDATE,DELETE,)DDLs including CREATE TABLE AS SELECTSupport inside VIEWsInteroperabilityInvoke JavaScript&SQL functions and Programs inside existing SQL stored functions or proceduresChain JavaScript&SQL stored functions t
37、ogether using input/output argumentsCopyright 2024 Oracle and/or its affiliates43SELECT col1,col2,gcd_js(col1,col2)FROM my_tableWHERE gcd_js(col1,col2)1ORDER BY gcd_js(col1,col2);CREATE TABLE gcd_tableAS SELECT gcd_js(col1,col2)FROM my_table;CREATE TABLE gcd_tableAS SELECT gcd_js(col1,col2)FROM my_t
38、able;SQL inside JavaScriptStatement TypesSimple SQL statementsPrepared statements with bind parametersData Access APIExecute SQL inside JavaScript using XDevAPISeamless MySQL JavaScript type conversion for query resultsSession StateContinue transactions inside JavaScriptAccess all session state insi
39、de JavaScript such as session variables&temporary tablesCopyright 2024 Oracle and/or its affiliates44CREATE PROCEDURE gen_random_age(IN row_count INT)LANGUAGE JAVASCRIPT AS$let insertStatement=session.prepare(INSERT INTO my_table(age)VALUES(?);for(let j=0;j Division by Zero!SELECT mle_session_state(
40、stdout);validating input value:0 SELECT mle_session_state(stack_trace);validate(division:9:187-214)division(division:11:222-232):anonymous(division:15:256-265)JavaScript inside MySQL ServerWorks seamlessly with:InnoDBHA/ReplicationHeatWave AnalyticsHeatWave AutoMLHeatWave AutoPilotHeatWave Lakehouse
41、Copyright 2024 Oracle and/or its affiliates46JavaScript Stored Programs:Key Benefits47Copyright 2024 Oracle and/or its affiliatesExpress complex logic in database using JavaScript01Push data-intensive application logic inside the database02Reduce data movement cost03Includes GraalVM Enterprise Editi
42、on optimizations at no additional cost 04Integrates with MySQL HeatWave05MySQL for Developers LicenseFREE DOWNLOAD OF MYSQL ENTERPRISE EDITION FROM OTNFull Access to MySQL Enterprise EditionFull Access to MySQL Enterprise EditionEnterprise ServerEnterprise ServerBackupBackupRouterRouterShellShellCon
43、nectorsConnectorsJavaScript JavaScript Learn,Develop,PrototypeLearn,Develop,PrototypeDownload Nowhttps:/ Kubernetes OperatorProvides a consistent environment across development,testing,and productionAllows developers to focus on code changesCopyright 2024 Oracle and/or its affiliates49KubernetesA po
44、rtable,extensible,open-source platform for managing containerized workloads and services,that facilitates both declarative configuration and automation.Kubernetes Operator Method of automatically deploying and managing a service.Goals of an operator:DeploymentConfigurationSelf-healingBackup&RestoreO
45、bservabilityUsing Kubernetes custom resources Both Kubernetes Operator&MySQL InnoDB Clustershare a common goal to make it easier to deploy,automate and manage a service.Copyright 2024,Oracle and/or its affiliates.All rights reserved.https:/ with KubernetesCopyright 2024,Oracle and/or its affiliates.
46、All rights reserved.52 Modern container based development model Kubernetes MySQL operator seamlessly streamlines Containerized to Containerized Dev to QA QA to ProductionMySQL maintains container imagesMySQL OperatorAutomated deployment and managementServerRouterHA/DRSelf-healingBackup&Restore to/fr
47、omObject StoresScaleup/ScaledownRolling upgradesMinimizes downtimeConfiguration ManagementDatabase Cloning Private container registriesCNCF cert-manager supportEnterprise EditionCopyright 2024,Oracle and/or its affiliates.All rights reserved.53https:/ 2024,Oracle and/or its affiliates.All rights res
48、erved.54MySQL Operator for Kubernetes ArchitectureUses ControllersManage the life-cycle of containerized workloads Workload run as PodsA MySQL Operator isSoftware running inside the Kubernetes clusterInteracts with the Kubernetes API to observe resources and services to assist with the life-cycle ma
49、nagement.Via Kubernetes controllers the operator configures MySQL MySQL Servers MySQL Replication(using Group Replication)MySQL RouterCopyright 2024,Oracle and/or its affiliates.All rights reserved.55Install the Kubernetes ExtensionEdit your manifest fileOpen Command PalletteRun Kubernetes Createhtt
50、ps:/ 2024,Oracle and/or its affiliates.All rights reserved.56Defineusing YAMLVS Code k8 extension running MySQL Innodb Cluster57Copyright 2024 Oracle and/or its affiliatesCreate complete Environment Stackwith KubernetesFor example Adding WordPress to MySQL Defining the appdev ecosystemCopyright 2024
51、,Oracle and/or its affiliates.All rights reserved.58Conclusion59Copyright 2024 Oracle and/or its affiliatesEquipped with these next generation toolsDevelopers can Increase efficiency and productivityAutomate tasksFocused App DevIntegrated documentationImprove qualityAutomated checksTesting environmentSimplify architectureReduce Time to MarketShortened development timeQuickly iterate Q&AThank You!Copyright 2024 Oracle and/or its affiliates60