From d583a88df74532b2245b66b14301d92b5075b09b Mon Sep 17 00:00:00 2001 From: Perry Skountrianos Date: Fri, 25 Mar 2016 12:23:00 -0700 Subject: [PATCH] Reverting... --- README.md | 12 +++- README_samples_template.md | 56 +++++++++++++++++++ license.txt | 7 +++ samples/in-memory/README.md | 12 ++++ .../DemoWorkload/FrmConfig.Designer.cs | 2 +- .../DemoWorkload/FrmMain.cs | 5 +- samples/master-data-services/README.md | 5 ++ samples/r-services/README.md | 3 + 8 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 README_samples_template.md create mode 100644 license.txt create mode 100644 samples/in-memory/README.md create mode 100644 samples/master-data-services/README.md create mode 100644 samples/r-services/README.md diff --git a/README.md b/README.md index d1cdaa05..1351c2d2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ -# SQL-Server-Samples +# SQL Server Code Samples +This GitHub repository contains code samples that demonstrate how to use SQL Server features. Each sample includes a README file that explains how to run and use the sample. -Coming Soon... +## Working in GitHub +To work in GitHub, go to https://github.com/microsoft/sql-server-samples and fork the repository. Work in your own fork and when you are ready to submit to make a change or publish your sample for the first time, submit a pull request into the master branch of sql-server-samples. One of the approvers will review your request and accept or reject the pull request. + +## License +These samples and templates are all licensed under the MIT license. See the license.txt file in the root. + +## Questions +Email questions to: sqlserversamples@micrososft.com. diff --git a/README_samples_template.md b/README_samples_template.md new file mode 100644 index 00000000..deee3483 --- /dev/null +++ b/README_samples_template.md @@ -0,0 +1,56 @@ +# Ticket Reservations Sample + +Ticket Reservations is a Windows Forms sample application built on .NET Framework 4.6 that demonstrates the performance benefits of using SQL Server memory optimized tables and native compiled stored procedures. You can compare the performance before and after enabling In-Memory OLTP by observing the transactions/sec as well as the current CPU Usage and latches/sec. + +![Alt text](samples/in-memory/ticket-reservations/Screenshots/1.png "Ticket Reservations") + +## Running this sample +1. Before you can run this sample, you must have the following perquisites: + - SQL Server 2016 CTP3 (or higher) + - Visual Studio 2015 (or higher) with the latest SSDT installed. + +2. Clone this repository using Git for Windows (http://www.git-scm.com/), or download the zip file. + +3. From Visual Studio, open the **InMemoryOLTPDemo.sln** file from the root directory. + +4. In Visual Studio Build menu, select **Build Solution** (or Press F6). + +5. In the **App.config** file, located in the project root, find the **TicketReservations** app setting and edit the connectionString if needed. Currently it is configured to connect to the local default SQL Server Instance using Integrated Security. + +6. Publish the TicketReservations Database + - Right click on the TicketReservations SQL Server Database Project and Select **Publish** + - Click Edit... to choose your connection string + - Click Publish + - Note: For publishing to Azure SQL you need to change the DB project target platform to **Microsoft Azure SQL Database V12** + +7. You can now run and debug the application locally by pressing **F5** in Visual Studio. + +8. Start the workload with the **Start** button, and run for a while to show perf profile. Then press stop to stop the workload. + +9. In the database project, + - Change TicketReservations.sql to a memory-optimized table (instructions commented in the file itself) + - Change InsertTicketReservations.sql to natively compiled (instructions in the same file) + +10. Publish the database project to the same database – the tool will take care of making the necessary changes. + Note that, as part of publication, the data is copied from the old disk-based table to the new memory-optimized table, so the longer you run the initial workload, the longer this publication takes. + +11. Go back to the app and run the workload again. No need to recompile or restart the application. + +The perf gains from In-Memory OLTP as shown by the load generation app depend on two factors: +- Hardware + - more cores => higher perf gain + - slower log IO => lower perf gain +- Configuration settings in the load generator + - more rows per transaction => higher perf gain + - more reads per write => lower perf gain + - default setting is 10 rows per transaction and 1 read per write + +With default settings on one machine with 24 logical cores and relatively slow SSD for the log the app shows around performance 40X gain, and in this case the bottleneck was log IO. + + +## About the code +The code included in this sample is not intended to be a set of best practices on how to build scalable enterprise grade web applications. This is beyond the scope of this quick start sample. + +## More information +- [In-Memory OLTP (In-Memory Optimization)] (https://msdn.microsoft.com/en-us/library/dn133186.aspx) +- [OLTP and database management] (https://www.microsoft.com/en-us/server-cloud/solutions/oltp-database-management.aspx) diff --git a/license.txt b/license.txt new file mode 100644 index 00000000..88bdce42 --- /dev/null +++ b/license.txt @@ -0,0 +1,7 @@ +Copyright (c) Microsoft Corporation. Distributed under the following terms: + +1. Microsoft and any contributors to this project each grants you a license, under its respective copyrights, to the Microsoft SQL Server Sample Documentation under the [Creative Commons Attribution 3.0 United States License](http://creativecommons.org/licenses/by/3.0/us/legalcode). In addition, with respect to any sample code contained in the documentation, Microsoft and any such contributors grants you an additional license, under its respective intellectual property rights, to use the code to develop or design your software for Microsoft SQL Server and Microsoft Azure. + +2. Microsoft, Windows, Microsoft SQL Server, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. This license does not grant you rights to use any names, logos, or trademarks. For Microsoft’s general trademark guidelines, go to [http://go.microsoft.com/fwlink/?LinkID=254653](http://go.microsoft.com/fwlink/?LinkID=254653). + +3. Microsoft and any contributors reserves all others rights, whether under copyrights, patents, or trademarks, or by implication, estoppel or otherwise. \ No newline at end of file diff --git a/samples/in-memory/README.md b/samples/in-memory/README.md new file mode 100644 index 00000000..5757615f --- /dev/null +++ b/samples/in-memory/README.md @@ -0,0 +1,12 @@ +# SQL Server In-memory + +In-Memory OLTP can significantly improve OLTP database application performance. It is a memory-optimized database engine integrated into the SQL Server engine, optimized for OLTP. With In-Memory OLTP you can increase the transaction throughput by up to 30 times, depending on the specifics of the workload. The performance gains come from: + - For memory-optimized tables, the design of their structure is free of the physical limitations of hard drives that force design compromises. + - Core transaction processing is completely free of locks. + - Natively compiled modules execute Transact-SQL statements more efficiently. + +Read the following resources for mroe information. +- [In-Memory OLTP (In-Memory Optimization)] (https://msdn.microsoft.com/en-us/library/dn133186.aspx) +- [Quick Start 1: In-Memory OLTP Technologies for Faster Transact-SQL Performance] (https://msdn.microsoft.com/en-us/library/mt694156.aspx) +- [Get started with Columnstore for real time operational analytics] (https://msdn.microsoft.com/en-us/library/dn817827.aspx) +- [Columnstore Indexes Guide] (https://msdn.microsoft.com/en-us/library/gg492088.aspx) diff --git a/samples/in-memory/ticket-reservations/DemoWorkload/FrmConfig.Designer.cs b/samples/in-memory/ticket-reservations/DemoWorkload/FrmConfig.Designer.cs index 25b94df0..00119463 100644 --- a/samples/in-memory/ticket-reservations/DemoWorkload/FrmConfig.Designer.cs +++ b/samples/in-memory/ticket-reservations/DemoWorkload/FrmConfig.Designer.cs @@ -174,7 +174,7 @@ this.txtMaxTPS.Size = new System.Drawing.Size(99, 20); this.txtMaxTPS.TabIndex = 37; this.txtMaxTPS.TabStop = false; - this.txtMaxTPS.Text = Program.MAX_TPS.ToString(); + this.txtMaxTPS.Text = "70"; // // lblRunningThread // diff --git a/samples/in-memory/ticket-reservations/DemoWorkload/FrmMain.cs b/samples/in-memory/ticket-reservations/DemoWorkload/FrmMain.cs index e2583fa8..cc4b293e 100644 --- a/samples/in-memory/ticket-reservations/DemoWorkload/FrmMain.cs +++ b/samples/in-memory/ticket-reservations/DemoWorkload/FrmMain.cs @@ -1,4 +1,4 @@ -//---------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, @@ -53,7 +53,6 @@ namespace DemoWorkload public FrmMain() { InitializeComponent(); - uiControls.speedDial.MaxValue = Program.MAX_TPS; } delegate void SetInt64Callback(Int64 value); @@ -92,7 +91,7 @@ namespace DemoWorkload /// private void UpdateElapsed(string Elapsed) { - this.lblTime.Text = Elapsed.ToString(); + this.lblTime.Text = Elapsed.ToString(); } /// diff --git a/samples/master-data-services/README.md b/samples/master-data-services/README.md new file mode 100644 index 00000000..fac7c4ae --- /dev/null +++ b/samples/master-data-services/README.md @@ -0,0 +1,5 @@ +# Master Data Services + +Master Data Services (MDS) is the SQL Server solution for master data management. Master data management (MDM) enables you organization to discover and define non-transactional lists of data, and compile maintainable, reliable master lists. This article briefly describe the MDS components and provides links to additional information. + +For information about the new features in SQL Server 2016, see [What's New in Master Data Services (MDS)] (https://msdn.microsoft.com/en-us/library/ff929136.aspx). diff --git a/samples/r-services/README.md b/samples/r-services/README.md new file mode 100644 index 00000000..bb8dc0e2 --- /dev/null +++ b/samples/r-services/README.md @@ -0,0 +1,3 @@ +# R Services + +[SQL Server 2016 R Services] (http://blogs.microsoft.com/firehose/tag/sql-server-2016-r-services/)