title: Sending 9000/s push notifications for iOS
body: <p>My system has about 10000 iOS users and i want to send them a push notification but without taking time as i may send another message after 5 minutes or less for the same user,
  I read this answer before which also founded in Apple Site:</p>
  
  <blockquote>
    <p>Push Notification Throughput and Error Checking</p>
    
    <p>There are no caps or batch size limits for using APNs. The iOS 6.1
    press release stated that APNs has sent over 4 trillion push
    notifications since it was established. It was announced at WWDC 2012
    that APNs is sending 7 billion notifications daily.</p>
    
    <p>If you're seeing throughput lower than 9,000 notifications per second,
    your server might benefit from improved error handling logic.</p>
  </blockquote>
  
  <p>But a don't know how to send 9000/s message while i'm sending the notification one by one.</p>
  
  <p>I'm using Python (PyAPNs) and this is my code:</p>
  
  <pre><code>from apns import APNs,Payload
  result = execute("SELECT token_hex FROM `Users`")
  for row in result:
      token_hex = row['token_hex']
      apns = APNs(use_sandbox=False, cert_file='Cert.pem', key_file='CertKey.pem')
      payload = Payload(alert="Message",badge=1,sound='default')
      apns.gateway_server.send_notification(token_hex, payload)
  </code></pre>
  
  <p>I'm sending to 10000 users in more than 30 minutes...</p>
  
  <p>So what is the problem in my code or what can i do to send the notification in less time...</p>
  
  <p>Thanks in Advance,</p>