Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
RavenDB 2.x Beginner's Guide

You're reading from  RavenDB 2.x Beginner's Guide

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283798
Pages 356 pages
Edition 1st Edition
Languages
Author (1):
Khaled Tannir Khaled Tannir
Profile icon Khaled Tannir

Table of Contents (21) Chapters

RavenDB 2.x Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Getting Started with RavenDB RavenDB Management Studio RavenDB.NET Client API RavenDB Indexes and Queries Advanced RavenDB Indexes and Queries Advanced RavenDB Document Capabilities RavenDB Administration Deploying RavenDB Scaling-out RavenDB RavenDB Profiling RavenDB HTTP API Putting It All Together Pop Quiz Answers Index

Chapter 10. RavenDB Profiling

How do you know if a server is doing its work optimally? One of the most common performance-related requests we receive in our consulting practice is to find out why a specific query is not executing quickly enough and to troubleshoot mysterious intermittent bottlenecks.

This chapter discusses the RavenDB profiling and stress tools. You will learn how to enable and use these tools which may help you to speed up your server's overall workload, speed up a single query, or troubleshoot and solve a problem when it's hard to observe and you don't know what causes it or even how it manifests.

In this chapter, we will cover:

  • The RavenDB profiler

  • Using the profiler information

  • RavenDB visual host, workload simulator, and stress tests

What is profiling?


Talking about profiling and performance optimization is out of the scope of this book. In easy words, the profiling process consists of multiple analyses that investigate the structure and the content of the data, the processing time, and also make inferences about this information. After the analysis is complete, we can review the results and accept or reject the inferences. Basically, we use the profiling process to evaluate the quality of the data and the time taken to process this data. So, we can say that profiling is the primary means of measuring and analyzing where time is consumed.

When analyzing a profiling result, we aim to understand why a given server requires a certain amount of time to respond to a query and try to reduce or eliminate whatever unnecessary work it's doing to achieve the result. This is called optimization. In other words, we need to measure where the time goes in order to optimize it. The following figure illustrates the profiling process...

Time for action – enabling the RavenDB profiler


To learn more about the RavenDB profiler's capabilities, you will now create the ASP.NET MVC application RavenDBProfiling, which implements the profiler. You will implement only the necessary code to enable the profiler to monitor the application which will connect to the World database (created in the previous chapters) and retrieve documents from the Countries collection. Then, you will view and analyze the profiler's information report:

  1. Open Visual Studio, create a new ASP.NET MVC 4 Web Application, and name it RavenDBProfiling.

  2. Use the NuGet package manager to add the RavenDB Client MVC integration package. While it installs the package, it will automatically add the RavenDB Client package.

  3. In the Solution Explorer, select the Models folder, right-click on it to add a new class, and name it Country (the class definition that we used in the previous chapters).

  4. Add the static IDocumentStore field and the InitializeRavenProfiler() method to the...

Time for action – running the RavenDB visual host


You will now modify the RavenDBProfiling application to address the RavenDB visual host. You will add the Create Country view to the RavenDBProfiling application in order to enter some document data in an easy way and store these documents in the visual host instances. Then, you will observe and analyze request and response details in the visual host:

  1. In Windows Explorer, go to the ~\Sample folder of the RavenDB installation package and open the Raven.Samples.sln solution.

  2. Set the Raven VisualHost project as the startup project. Then, press F5 to build and run the Visual Host (or run the Raven.VisualHost.exe file).

    Note

    You may need the administrator privileges in order to run the RavenDB visual host.

  3. Click on the Start button in order to create and run 1 (one) RavenDB instance.

  4. Open the RavenDBProfiling application and modify the DocumentStore object initialization code in the Global.asax.cs file to look like the following code snippet:

    Note

    The...

RavenDB workload simulator/stress tests


A workload is the amount of work a system has to perform in a given time. In the performance field, a workload usually refers to the combined load placed on an application by the set of clients it services. A database workload can be defined as a set of statements that you execute against a database server that you want to tune.

Basically, a workload simulator aims to help in performance analysis, and it is important that it reproduces repeatable results. If the workload is run several times in an identical fashion, it should produce results that are almost identical.

Stress testing is a part of the process of performance testing which tries to identify the breaking point in a system under test by overwhelming its resources or by taking resources away from it. The main purpose of a stress test is to find the infrastructure problems within an installation. It can also be used for hardware sizing, system tuning, or benchmarking.

RavenDB provides two external...

Summary


In this chapter, we learned about RavenDB profiling and stress tools. We covered how to enable and use these tools in order to optimize and tune a RavenDB server. Specifically, we covered the RavenDB profiler and how to install it and analyze its output information.

We learned about the RavenDB visual host and how it may help you to profile and simulate the RavenDB server instances.

We also took a look at two RavenDB externals tools: the RavenDB simulated workload and the RavenDB stress test tools which you can build and use to tune your RavenDB server performance.

Now we've learned a lot about RavenDB, we're ready to learn how to connect to the RavenDB server using the REST protocol rather than the Microsoft .NET framework—which is the topic of the next chapter.

lock icon The rest of the chapter is locked
You have been reading a chapter from
RavenDB 2.x Beginner's Guide
Published in: Sep 2013 Publisher: Packt ISBN-13: 9781783283798
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}