Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6136009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:33:00+00:00 2026-05-23T17:33:00+00:00

I have a script that reads simpledb domains and writes them to s3. the

  • 0

I have a script that reads simpledb domains and writes them to s3. the performance is mediocre at best. Is there a way to increase the read speed?

import boto
import datetime
from xml.dom.minidom import Document
from boto.s3.key import Key

awsa = "myawsaccesskey"
awss = "myawssecretkey"

conn = boto.connect_sdb(awsa, awss)
domains = conn.get_all_domains()
s3conn = boto.connect_s3(awsa, awss)
archbucket = s3conn.get_bucket("simpledbbu")
for d in domains:
    print d.name
    doc = None
    doc = Document()
    root = doc.createElement("items")
    doc.appendChild(root)
    countermax = 0
    counter = 0
    for item in d:
        print "loading {0} of {1}".format(counter,countermax)
        counter += 1
        node = doc.createElement("item")
        node.setAttribute("itemName", item.name)
        for k,v in item.items():
            if not isinstance(v, basestring):
                i = 0
                for val in v:
                    node.setAttribute("{0}::{1}".format(k,i),val)
                    i += 1
            else:
                node.setAttribute(k,v)
        root.appendChild(node)
    k = Key(archbucket)
    k.key = "{0}/{1}".format(datetime.date.today().strftime("%Y%m%d"),d.name)
    x = doc.toprettyxml(indent="  ")
    k.set_contents_from_string(x)

here’s the profile:

ncalls  tottime percall cumtime percall filename:lineno(function)
2035    1.312   0.001   1.312   0.001   {built-in method read}
2   0.445   0.223   0.445   0.223   {built-in method do_handshake}
17  0.355   0.021   0.355   0.021   {built-in method write}
2   0.321   0.161   0.321   0.161   {_ssl.sslwrap}
2   0.292   0.146   0.292   0.146   {_socket.getaddrinfo}
2   0.177   0.089   0.177   0.089   {method 'connect' of '_socket.socket' objects}
14  0.012   0.001   0.077   0.005   {built-in method Parse}
2   0.01    0.005   0.047   0.023   __init__.py:24(<module>)
3369    0.01    0   0.012   0   item.py:71(endElement)
1   0.009   0.009   3.185   3.185   backupSimpleDb_0.0.py:1(<module>)
3508    0.009   0   0.03    0   expatreader.py:300(start_element)
4145    0.008   0   0.011   0   StringIO.py:208(write)
3508    0.007   0   0.019   0   handler.py:31(startElement)
3508    0.007   0   0.02    0   handler.py:37(endElement)
1   0.006   0.006   0.006   0.006   {nt.urandom}
3114    0.006   0   0.009   0   item.py:58(startElement)
1208    0.005   0   0.005   0   minidom.py:343(__init__)
1208    0.005   0   0.025   0   minidom.py:686(setAttribute)
258/3   0.005   0   0.024   0.008   minidom.py:794(writexml)
1   0.004   0.004   0.007   0.007   exception.py:26(<module>)
1   0.004   0.004   0.007   0.007   expatreader.py:4(<module>)
1   0.004   0.004   0.007   0.007   urllib.py:23(<module>)
1   0.004   0.004   0.006   0.006   utils.py:5(<module>)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:33:00+00:00Added an answer on May 23, 2026 at 5:33 pm

    Run 5 or 10 threads in parallel and have each copy one domain.

    This is actually pretty simple if you use a queue for domains to copy and have the threads wait for elements in the queue.

    http://www.ibm.com/developerworks/aix/library/au-threadingpython/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that writes to a named pipe and another that reads
I have a script that reads a form and puts some info into a
I have a script that reads RSS feeds using fopen & fgets. When trying
Ok, So i have a script that reads in a csv file and in
know nothing about php, but I have this script that reads a folder and
I have a PHP script that reads a file and outputs it to the
I have a python script that reads from a config file. The config file
I have a Zend/PHP script that reads rows from a table in one MySQL
I have a script that reads of a global config file using Config::Tiny. Based
I have a script that reads a large file line by line. The record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.