DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Debugging Memory Issues with RavenDB using WinDBG

Oren Eini user avatar by
Oren Eini
·
Dec. 12, 12 · Interview
Like (0)
Save
Tweet
Share
2.72K Views

Join the DZone community and get the full member experience.

Join For Free

we had gotten a database export that showed a pretty rough case for ravendb. a small set of documents (around 7k) that fan out in multiple map/reduce indexes to be around 70k to 180k (depending of which index is used).

as you can imagine, this puts quite a load on the system, i tried to use the usual methods (dottrace, hand picking, etc) and we did get some good results on that, we found some pretty problematic issues along the way, and it was good. but we still had the ravendb process take way too much memory. that means that we had to pull the big guns, windbg.

i took a dump of the process when it was using about 1 gb of memory, then i loaded that dump into windbg (6.2.9200.20512 amd64).

i loaded sos:

.loadby sos clr

then, the first thing to do was to try to see what is going on with the threads:

image

as you can see, we have a small number of threads, but nothing to write home about. the next step is to see if we have anything very big in the heap:

!dumpheap –stat

image

the first number is the method table address, the second is the count, and the third is the total size. the problem is that all of that combine doesn’t reach near as much memory as we take.

i guess it is possible that we hold a lot of data in the stack, especially since the problem is likely caused by indexing.

i decided to map all of the threads and see what they are doing.

image

switches me to thread #1, and we can see that we are currently in a waiting. dumping the stack reveals:

image

this seems to be the debugger thread. let us look at the rest:

  • 2 – finalizer
  • 3 – seems to be an inactive thread pool thread.
    image
  • 6 – appears to be an esent thread:
    image
    i am not sure what this is doing, and i am going to ignore this for now.
  • 7 – also esent thread:
    image

and… i got tired of this, and decided that i wanted to do something more productive, which is to selectively disable things in ravendb until i find something that drops the memory usage enough to be worth while.

whack a mole might not be a great debugging tool, but it the essence of binary search. or so i tell myself to make my conscience sleep more easily.

for reference, you can look at the dump file here .




Memory (storage engine)

Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Why Every Fintech Company Needs DevOps
  • Why You Should Automate Code Reviews
  • How To Generate Code Coverage Report Using JaCoCo-Maven Plugin
  • Spring Cloud: How To Deal With Microservice Configuration (Part 1)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: