title: How to optimize upload routine using Delphi 2010?
body: <p>My <strong>yet to be released</strong> Delphi 2010 application allows users to upload their files to my servers. Right now I'm using HTTPS POST to send the files, the (simplified) algorithm is basically:</p>
  
  <ol>
  <li>Split File into "slices" (256KB each)</li>
  <li>For each slice, POST it to server</li>
  </ol>
  
  <p>ie. for a 1MB file:</p>
  
  <pre><code>--&gt; Get Slice #1 (256KB)
  --&gt; Upload Slice #1 using TidHTTP.Post()
  
  --&gt; Get Slice #2 (256KB)
  --&gt; Upload Slice #2 using TidHTTP.Post()
  
  --&gt; Get Slice #3 (256KB)
  --&gt; Upload Slice #3 using TidHTTP.Post()
  
  --&gt; Get Slice #4 (256KB)
  --&gt; Upload Slice #4 using TidHTTP.Post()
  </code></pre>
  
  <p>I'm using <strong>Indy 10</strong>. I (ab)used my profiler over and over and there are not much left to optimize except changing the upload routine itself.</p>
  
  <p>I'm also using <strong>multi-threading</strong>, and even though I did my best to optimize my code, my benchmarks still tell me I can do better (there are other well optimized software that do achieve a <strong>much</strong> better timing...almost twice as fast as my upload routine!)</p>
  
  <p>I know it's not my server's fault...here are the ideas that I still need to explore:</p>
  
  <ol>
  <li><p>I tried grouping slices in a single POST, naturally this resulted in a performance boost (20-35%) but resuming capability is now reduced.</p></li>
  <li><p>I also thought about using SFTP / SSH, but I'm not sure if it's fast.</p></li>
  <li><p>Use web sockets to implement resumable upload (like <a href="http://code.google.com/p/delphionrails/">this component</a>), I'm not sure about speed either.</p></li>
  </ol>
  
  <p>Now my question is: is there something I can do to speed up my upload? I'm open to <strong>any</strong> suggestion that I can implement, including commandline tools (if license allows me to ship it with my application), provided that:</p>
  
  <ol>
  <li>Resumable upload is supported</li>
  <li>Fast!</li>
  <li>Reasonable memory usage</li>
  <li>Secure &amp; allow login/user authentication</li>
  </ol>
  
  <p>Also, because of major security concerns, FTP is a not something I'd want to implement.</p>
  
  <p>Thanks a lot!</p>