Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Too many VLFs

Author  Topic 

shah429
Yak Posting Veteran

52 Posts

Posted - 2009-07-31 : 05:46:49
Hi All, I understand that if the VLFs are of larger size, it can degrade performance as it might take quite a bit of time to clear the vlf when a log backup is performed. Is that correct? Secondly I want to know how too many VLFs can degrade performance or create fragmentation in the transaction log. Can anybody please advice. Thanks in advance guys.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-07-31 : 07:04:35
http://msdn.microsoft.com/en-us/library/ms178037%28SQL.90%29.aspx
http://sqlblogcasts.com/blogs/tonyrogerson/archive/2007/07/25/sql-2000-yes-lots-of-vlf-s-are-bad-improve-the-performance-of-your-triggers-and-log-backups-on-2000.aspx

Tony's suggestions on setting the right size for the log files and changing (or shutting off) autogrow are spot on. Make sure you are backing up the log frequently enough to prevent autogrow, or use Simple recovery mode if you don't need point-in-time recovery.
Go to Top of Page

shah429
Yak Posting Veteran

52 Posts

Posted - 2009-07-31 : 10:19:09
Well, the question was HOW TOO MANY VLFs cause a performance bottleneck. I know how to prevent it, I just want to understand HOW it is causing fragmentation in the log file. I posted the same question on the MSDN forums and people started explaining how to avoid the problem, so I posted the question here again. Anyone please? Thanks in advance
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-07-31 : 15:02:38
Post a comment on Tony's blog and see if he answers. I don't know the details offhand, but basically it comes down to physical and logical fragmentation causes more random I/O. Having fewer VLFs, and/or contiguous VLFs, reduces that and possibly permits sequential I/O.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-08-05 : 12:52:24
Whats a VLF?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-08-05 : 13:05:05
quote:
Originally posted by X002548

Whats a VLF?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam







Virtual Log File


SQL Server 2005 Books Online: Transaction Log Physical Architecture
http://msdn.microsoft.com/en-us/library/ms179355(SQL.90).aspx





CODO ERGO SUM
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-05 : 13:39:10
See Kimberley Tripp's blog post here
http://www.sqlskills.com/BLOGS/KIMBERLY/post/Transaction-Log-VLFs-too-many-or-too-few.aspx



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

shah429
Yak Posting Veteran

52 Posts

Posted - 2009-08-05 : 18:03:26
Could you put it into words based on Kimberley's blog post? You probably can't because she didn't cover that. I had the same question posted on the msdn forums and nobody could reply. Not sure if anybody knows...
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-08-05 : 20:43:50
Let me ask some questions:

1) Are you experiencing the problem on your SQL Servers and wish to correct it?
2) Are you trying to prevent the problem from ever occurring?
3) Are you simply curious about the causes and want to educate yourself on the internals of SQL Server log I/O?

Unless you are only interested in #3, the links that have been provided should answer all of your questions. If not, you are going to have to provide a detailed example of the kind of answer you want.
Go to Top of Page

shah429
Yak Posting Veteran

52 Posts

Posted - 2009-08-06 : 02:16:14
Well the question is clear, how/why does having too many VLFs cause a performance degradation? I can't be more clear than this.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-06 : 02:35:51
I think it's pretty clear with this estimate
quote:
* chunks less than 64MB = 4 VLFs
* chunks of 64MB and less than 1GB = 8 VLFs
* chunks of 1GB and larger = 16 VLFs

If your number of VLFs exceed {4, 8, 16}m then your log file probably is fragmented (you have too many VLFs) and performance will degrade.

I don't know how much more clear I can be? You didn't provide ANY information about your environment so we have to give you a general answer. For example, you didn't tell us how large your current log file is, what size it was originally and neither how many time it as exanded (either manually nor with auto-growth).

Then, of course, you have to do some math yourself. I hope this isn't too hard for you?
If you need further help, please post some relevant information and some specifics about your environment concerning the database of choice you need help with.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

shah429
Yak Posting Veteran

52 Posts

Posted - 2009-08-06 : 07:22:27
hmmm.. I don't know why you guys are not getting it. You said:

"If your number of VLFs exceed {4, 8, 16}m then your log file probably is fragmented (you have too many VLFs) and performance will degrade."

How are you going to justify that. Why do you think too many VLFs cause a problem/fragmentation. Check this link:

http://social.msdn.microsoft.com/Forums/en-US/sqldatabaseengine/thread/43105b39-0fb3-4276-a0c3-468277c37941/#fa3baaaa-81e1-4459-a523-865671943d4d
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-06 : 07:29:34
Maybe this angle clears your mind?
http://blogs.technet.com/magi/archive/2009/05/22/fragmentation-the-database-performance-killer.aspx

From the second paragraph of Kimberley Tripps blog post
quote:
If you preallocate a very large transaction log (10s to 100s of GB), SQL Server may only allocate a few VLFs - as a result, log backups will be allowed to run normally but, SQL Server only clears the inactive VLFs when you've moved into a different VLF. If your VLFs are 8GB in size, then you need to accumulate 8GB of log information before the log can be cleared...so, many of your log backups will occur normally but then one (the one that finally hits > 8GB in used size) will take quite a bit more time AND possibly cause you performance problems because it's now clearing 8GB of log information.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -