CXPacket and PAGEIOLATCH_EX or SH

  • My company processes data for our clients. We have one database for each of the clients. Largest DB is around 750 GB and the smaller ones would be around 100 GB. Main data load would be in batches and each batch would load around 3-4 million records each to 3-4 tables mainly. We are on SQL 2008, on VM with 16GB of RAM. Storage is SAN. Intel 4 core (hyperthreaded)

    During the loads, I see a lot of CXPacket waits coupled with PAGEIOLATCH_EX. I looked at the VMWare counter active bytes in MB and that is most often times at around 8GB. Does this mean that SQL Server is only using half of the available memorty? If yes, does that mean that PAGEIOLATCH_EX is because the disk subsystem ?

    Any ideas or direction would be greatly appreciated.

  • CXPacket waits are an indication of parallelism. Not to say that parallelism is the issue, just that it's going on. Something you'd have to validate.

    The latch waits are absolutely and indication of disk issues. If you're seeing them during loads, it sort of makes sense because that's when an exclusive lock is most likely to be taken out, but that's what you're seeing, IO.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks for your insight Grant. Yes, regarding CXPacket waits, I am looking into Parallelism. Right now, the queries (INSERTS) span as 16 threads and some of the threads are getting the CXPacket waits. I will have to see if I could rewrite the queries so that SQL Server could balance the work uniformly across these threads. Other option would be to reduce the MAXDOP to 3, 2 and 1 and also observe the performance.

    I am going to talk to the server team about the latches.

  • Another option on the parallelism is to look at the cost threshold for parallelism. That's usually left at the default value of 5 which is WAY too low for most systems. You might try bumping that up to 25 or 30 as a starting point.

    Since this is a virtual, we kind of can't trust the CPU measures, so be cautious about changing the maxdop settings unless you can also confirm from the VMWare monitoring that CPU is an issue.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I have seen heavy maxdop interfere with writes and I/O, but it would have to be an extreme case for me to look towards that as a culprit. If you are going to adjust for maxdop, which I do on massive inserts mostly to save threads for other processes, I wouldn't go down to 1 initially except for simple testing. If you're getting 16 threads, try halving it to 8, and another run at 4. If you get nearly the exact same timing runs, leave it there as it's not helping you but will interfere with other pieces of the system.

    +1 for Grant's observation about the CPU monitoring in VMWare as well. It's a skewed lens to look at the system through unless you're in the VM software itself.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Thanks to both for your thoughts. I was planning on gradually reducing the maxdop to see if there is any performance improvement. Regarding the memory and CPU, I am depending on the counters provided by VMware and not the regular windows counters.

    I will do some work on this and post my update shortly.

    Thanks for your time again.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply