Windows Scripting
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsSystem AdministrationWindows Scripting

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 11th, 2007, 03:48 AM
eglons eglons is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 29 eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 59 m 30 sec
Reputation Power: 0
Problems running a batch job

Hi, I've got several ASP programs which are looping through 1000's of records and then drilling into each of them, processing and moving on. The numner of database calls will be >100,000 through the run of the program.

Recently the jobs have started failing with and error

"Microsoft SQL Native Client: TCP Provider: Only one usage of each socket address (protocol/network address/port) is normally permitted."

I assumed I wasn't closing my recordset connections when I was done with them, but I have ascertained that this is not the issue.

Researching this it appears to be some limitation in the TCP Sockets which SqlServer allows to be opened (5000) and the time it takes to clear one once and close has been issued.

I am looking at tweaking server parameters to increase this but while playing about I found a way to make it work, and just wondered what the opinions of people here were about my technique:

I've alays opened a DB connect at the start of my page and closed it at the end of the page, using the same connection for all db work in the page. In this instance I decided to close the connect after each SQL call and reopen it before the next one... this got away from the failures, but I have no idea on the performance overheads?

Any comments?

Reply With Quote
  #2  
Old March 11th, 2007, 02:17 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
What does a batch job have to do with asp? What does your question have to do with asp? Why would you be using asp to do what you described, you should have some other programming environment do what you're describing imho.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old March 11th, 2007, 07:06 PM
eglons eglons is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 29 eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 59 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by Doug G
What does a batch job have to do with asp? What does your question have to do with asp? Why would you be using asp to do what you described, you should have some other programming environment do what you're describing imho.


It's actually a way of creating a flat file for upload to some partner sites... I use ASP because I know ASP (actually I've just changed it to be vbs but same principal applies)...

Ignoring the debate about how I should be doing it any ideas about the technique required, I'm basically asking whether there is a significantly different overhead in either of the following

open connection
loop
create recordset
process recordset
close/destroy recordset
end loop
close connection

or

loop
open connection
create recordset
process recordset
close/destroy recordset
close connection
end loop

Reply With Quote
  #4  
Old March 11th, 2007, 10:44 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 19 m 36 sec
Reputation Power: 181
Quote:
(actually I've just changed it to be vbs but same principal applies)...

Moved from the asp forum

Reply With Quote
  #5  
Old March 12th, 2007, 12:48 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,048 Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Days 12 h 32 m 33 sec
Reputation Power: 555
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
If I'm understanding you correctly, the simple solution to this is to not run this remotely. This should be run as a server cron.
__________________
Click the image if at any point you don't like my decision.

Scripting problems? Windows questions? Ask the Windows Guru!


Reply With Quote
  #6  
Old March 12th, 2007, 08:11 PM
eglons eglons is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 29 eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level)eglons User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 59 m 30 sec
Reputation Power: 0
I think you are understanding me correctly. Although this is a vbs script being run on a windows server through windows scheduler not cron.

Reply With Quote
  #7  
Old March 12th, 2007, 09:01 PM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,048 Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Days 12 h 32 m 33 sec
Reputation Power: 555
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
Okay, since there is no limit to the maximum number of sequential connections, it seems as though one of two things is happening.

Most likely there is an error that is preventing your connection from being properly closed. This "connection leak" prevents your script from connecting again on the next iteration.

The second, less likely culprit may have something to do with connection pooling.

Going on the first, here's my suggestions. Avoid constructing your code like the following:

Set oConn = blah blah blah
oConn.Open
' Instruction set
oConn.Close

If there is an error in any of your instructions, it can prevent oConn from being explicitly closed. Try this approach instead:

Set oConn = blah blah blah
oConn.Open
x = 0
Do Until x=1
' Instruction set
x = 1
Loop
oConn.Close

Of course you can use any native commands to create your do loop. I just wanted to demonstrate it here. This ensures that no matter what happens, your connection is always closed again.

Reply With Quote
  #8  
Old March 13th, 2007, 12:49 AM
Nilpo's Avatar
Nilpo Nilpo is offline
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Jun 2006
Location: Salem, OH
Posts: 1,048 Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)Nilpo User rank is Colonel (50000 - 60000 Reputation Level)  Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1Folding Points: 206875 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Days 12 h 32 m 33 sec
Reputation Power: 555
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo
MySpace
I thought I'd post back. You can achieve the same effect I proposed above without using a loop. This would work as well.

Set oConn = blah blah blah
oConn.Open
x = 0
If x = x Then
' Instruction set
End If
oConn.Close

Another possibility would be a With statement, but I can't find documentation to show it works.

Set oConn = blah blah blah
With oConn
.Open
' Instruction set
End With
oConn.Close

Reply With Quote
Reply

Viewing: ASP Free ForumsSystem AdministrationWindows Scripting > Problems running a batch job


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT