Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

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 Dev Shed Forums Sponsor:
  #1  
Old May 18th, 2001, 11:35 AM
Panic Panic is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Toronto, ON
Posts: 15 Panic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Running multiple commands at once

Ok, i've got a good question, it might be really easy, but I haven't been able to figure it out.

I have a program that select a list of id's and ip addresses from a table (part of a database that holds apache web logs). It select the id and ip, then uses the perl module Net:NS to reverse resolve the ip. It take the hostname and TTL for that record, and updates the table with the new information.

This works great, the only problem is, is that

1) it only resolves one ip at a time
2) it does a update to the database for every ip.

and this table is growing fast (at about 3000 records right now)

What I want to know, is how can I run multiple reverse lookups at the same time? Can I, using the Net:NS module, or any other way, open say 20 pipes/connections to the name server and lookup 20 ips at the same time? rather than one at a time?

Thanks!

Mike

Reply With Quote
  #2  
Old May 19th, 2001, 04:31 AM
Jessman72 Jessman72 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Centreville, Alabama
Posts: 25 Jessman72 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m 3 sec
Reputation Power: 0
Send a message via AIM to Jessman72
are you leaving your connection to the database open as you select your information

open your database


foreach $i (@IPS) {

select information based on $i and dump into an array
}


close database


parse out information from array and do whatever you want with the information. just let the loop build the array, and leave your database open until it is finished getting the information, then close it.

Reply With Quote
  #3  
Old May 19th, 2001, 09:34 AM
Panic Panic is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: Toronto, ON
Posts: 15 Panic User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I dont' leave the database connection open, it loads the table into a hash (%hosts{tableid} = ipaddress and disconnects

but either way, I woul still have to cycle through each elements of the array/hash and *foreach*, run the dns resolver, which would still do it one at a time.

I've been looking into this more, and It think the only why I am going to get his done, is by forking processes, and have each of the child proccesses do (number of children / total number of ip's to resolve)

Does anybody know if you can have uhhh *global variables that are shared/seen/changed by the parent and all the children?

Thanks!

Mike

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Running multiple commands at once


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 5 hosted by Hostway
Stay green...Green IT