![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | ftpwebrequest: Upload is slow... Hi, I just tried uploading files with the ftpwebrequest class. I find that they are really slow. However I am not sure if this is because of me... I am writing everything to the input stream byte by byte so that I can calculate the progress. However I only calculate only after 1024 bytes have been uploaded. Is there a better way to do this? Moreover are there any general property settings for the object so that ftp uploading is at least faster relatively speaking... --deostroll |
My System Specs![]() |
| | #2 (permalink) |
| | Re: ftpwebrequest: Upload is slow... "deostroll" <deostroll@xxxxxx> wrote in message news:c6ffd1d7-5ba1-4435-bc66-560dbf14dd62@xxxxxx Quote: > Hi, > > I just tried uploading files with the ftpwebrequest class. I find that > they are really slow. However I am not sure if this is because of > me... I am writing everything to the input stream byte by byte so that > I can calculate the progress. However I only calculate only after 1024 > bytes have been uploaded. Is there a better way to do this? > > Moreover are there any general property settings for the object so > that ftp uploading is at least faster relatively speaking... > > --deostroll such as 1024 bytes. Percentage is still bytes sent divided by total bytes. You just incriment the bytes sent by the block size, rather than by one. This may not be your problem as to speed, but it may help. -- Mike |
My System Specs![]() |
| | #3 (permalink) |
| | Re: ftpwebrequest: Upload is slow... On Jan 4, 5:20*pm, "Family Tree Mike" <F...@xxxxxx> wrote: Quote: > "deostroll" <deostr...@xxxxxx> wrote in message > > news:c6ffd1d7-5ba1-4435-bc66-560dbf14dd62@xxxxxx > Quote: > > Hi, Quote: > > I just tried uploading files with the ftpwebrequest class. I find that > > they are really slow. However I am not sure if this is because of > > me... I am writing everything to the input stream byte by byte so that > > I can calculate the progress. However I only calculate only after 1024 > > bytes have been uploaded. Is there a better way to do this? Quote: > > Moreover are there any general property settings for the object so > > that ftp uploading is at least faster relatively speaking... Quote: > > --deostroll > You can still calculate progress percentage if you use large byte blocks, > such as 1024 bytes. *Percentage is still bytes sent divided by total bytes. > You just incriment the bytes sent by the block size, rather than by one. > This may not be your problem as to speed, but it may help. > > -- > Mike normal? --deostroll |
My System Specs![]() |
| | #4 (permalink) |
| | Re: ftpwebrequest: Upload is slow... "deostroll" <deostroll@xxxxxx> wrote in message news:b6202b3d-5f15-4fd0-b8db-89e3f8bcac8f@xxxxxx Quote: > > I notice that the cpu usage goes to 100% while I do uploads! Is this > normal? > --deostroll That doesn't sound right, but it's hard to tell without seeing your code why that might occur. -- Mike |
My System Specs![]() |
| | #5 (permalink) |
| | Re: ftpwebrequest: Upload is slow... On Jan 4, 9:58*pm, "Family Tree Mike" <F...@xxxxxx> wrote: Quote: > "deostroll" <deostr...@xxxxxx> wrote in message > > news:b6202b3d-5f15-4fd0-b8db-89e3f8bcac8f@xxxxxx > > > Quote: > > I notice that the cpu usage goes to 100% while I do uploads! Is this > > normal? > > --deostroll > That doesn't sound right, but it's hard to tell without seeing your code why > that might occur. > > -- > Mike progressbar control. I've written a custom class for a datagridview progressbar column. Here while "painting" it so happens that I create a new progressbar control and draw its image in the cell meant to show the progress updates. Probably this is why it happens... Is it normally supposed to be slower than using ftp.exe? Why is this so? --deostroll |
My System Specs![]() |
| | #6 (permalink) |
| | Re: ftpwebrequest: Upload is slow... "deostroll" wrote: Quote: > The high CPU usage is probably high because of creating/destroying a > progressbar control. I've written a custom class for a datagridview > progressbar column. Here while "painting" it so happens that I create > a new progressbar control and draw its image in the cell meant to show > the progress updates. Probably this is why it happens... hope that is not what you meant... Quote: > > Is it normally supposed to be slower than using ftp.exe? Why is this > so? > > --deostroll > http://msdn.microsoft.com/en-us/libr...ebrequest.aspx It's true that the timings are somewhat slower (~40%) using the async upload. If you are seeing times increase significantly in your code, I would look at running your upload code in a console app to eliminate any issues with your UI update logic. Mike |
My System Specs![]() |
| | #7 (permalink) |
| | Re: ftpwebrequest: Upload is slow... On Jan 5, 11:01*pm, Family Tree Mike <FamilyTreeM...@xxxxxx> wrote: Quote: > "deostroll" wrote: Quote: > > The high CPU usage is probably high because of creating/destroying a > > progressbar control. I've written a custom class for a datagridview > > progressbar column. Here while "painting" it so happens that I create > > a new progressbar control and draw its image in the cell meant to show > > the progress updates. Probably this is why it happens... > This "sounds" like you are creating a new progress bar in each repaint. *I > hope that is not what you meant... > > > Quote: > > Is it normally supposed to be slower than using ftp.exe? Why is this > > so? Quote: > > --deostroll > I ran a few comparisons of ftp.exe versus the async upload code example athttp://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx > > It's true that the timings are somewhat slower (~40%) using the async > upload. *If you are seeing times increase significantly in your code, Iwould > look at running your upload code in a console app to eliminate any issues > with your UI update logic. > > Mike synchronous manner. The UI update is asynchronous. But its not a direct UI update. I am updating a datatable. My datagridview is bound to the datatable. However I synchronize the updates to this table. If I adopted the async solution how will I get the progress updates? --deostroll |
My System Specs![]() |
| | #8 (permalink) |
| | Re: ftpwebrequest: Upload is slow... "deostroll" wrote: Quote: > On Jan 5, 11:01 pm, Family Tree Mike > <FamilyTreeM...@xxxxxx> wrote: Quote: > > "deostroll" wrote: Quote: > > > The high CPU usage is probably high because of creating/destroying a > > > progressbar control. I've written a custom class for a datagridview > > > progressbar column. Here while "painting" it so happens that I create > > > a new progressbar control and draw its image in the cell meant to show > > > the progress updates. Probably this is why it happens... > > This "sounds" like you are creating a new progress bar in each repaint. I > > hope that is not what you meant... > > > > > > Quote: > > > Is it normally supposed to be slower than using ftp.exe? Why is this > > > so? Quote: > > > --deostroll > > I ran a few comparisons of ftp.exe versus the async upload code example athttp://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx > > > > It's true that the timings are somewhat slower (~40%) using the async > > upload. If you are seeing times increase significantly in your code, I would > > look at running your upload code in a console app to eliminate any issues > > with your UI update logic. > > > > Mike > As such the ftp-ing (and other stuff) happen on a separate thread in a > synchronous manner. The UI update is asynchronous. But its not a > direct UI update. I am updating a datatable. My datagridview is bound > to the datatable. However I synchronize the updates to this table. > > If I adopted the async solution how will I get the progress updates? > > --deostroll > to point out an existing example and the speed of that example relative to ftp.exe. If your upload times are significantly more than the ftp.exe (like a factor of two or more), then it is likely beneficial to time your upload code outside of any UI. If the upload code runs resonably well away from any UI, then you've narrowed the areas you need to review in your code. Mike |
My System Specs![]() |
| | #9 (permalink) |
| | Re: ftpwebrequest: Upload is slow... "Family Tree Mike" wrote: Quote: > > > "deostroll" wrote: > Quote: > > On Jan 5, 11:01 pm, Family Tree Mike > > <FamilyTreeM...@xxxxxx> wrote: Quote: > > > "deostroll" wrote: > > > > The high CPU usage is probably high because of creating/destroying a > > > > progressbar control. I've written a custom class for a datagridview > > > > progressbar column. Here while "painting" it so happens that I create > > > > a new progressbar control and draw its image in the cell meant to show > > > > the progress updates. Probably this is why it happens... > > > > > > This "sounds" like you are creating a new progress bar in each repaint. I > > > hope that is not what you meant... > > > > > > > > > > > > > Is it normally supposed to be slower than using ftp.exe? Why is this > > > > so? > > > > > > > --deostroll > > > > > > I ran a few comparisons of ftp.exe versus the async upload code example athttp://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx > > > > > > It's true that the timings are somewhat slower (~40%) using the async > > > upload. If you are seeing times increase significantly in your code, I would > > > look at running your upload code in a console app to eliminate any issues > > > with your UI update logic. > > > > > > Mike > > As such the ftp-ing (and other stuff) happen on a separate thread in a > > synchronous manner. The UI update is asynchronous. But its not a > > direct UI update. I am updating a datatable. My datagridview is bound > > to the datatable. However I synchronize the updates to this table. > > > > If I adopted the async solution how will I get the progress updates? > > > > --deostroll > > > Sorry, I did not mean to imply trying the async method. I was just trying > to point out an existing example and the speed of that example relative to > ftp.exe. > > If your upload times are significantly more than the ftp.exe (like a factor > of two or more), then it is likely beneficial to time your upload code > outside of any UI. If the upload code runs resonably well away from any UI, > then you've narrowed the areas you need to review in your code. > > Mike > you could just add a PercentComplete property to the FtpState class and monitor that value from some other part of the code which updates the UI. Mike |
My System Specs![]() |
| | #10 (permalink) |
| | Re: ftpwebrequest: Upload is slow... On Jan 6, 6:26*pm, Family Tree Mike <FamilyTreeM...@xxxxxx> wrote: Quote: > "Family Tree Mike" wrote: > Quote: > > "deostroll" wrote: Quote: Quote: > > > On Jan 5, 11:01 pm, Family Tree Mike > > > <FamilyTreeM...@xxxxxx> wrote: > > > > "deostroll" wrote: > > > > > The high CPU usage is probably high because of creating/destroying a > > > > > progressbar control. I've written a custom class for a datagridview > > > > > progressbar column. Here while "painting" it so happens that I create > > > > > a new progressbar control and draw its image in the cell meant toshow > > > > > the progress updates. Probably this is why it happens... Quote: Quote: > > > > This "sounds" like you are creating a new progress bar in each repaint. *I > > > > hope that is not what you meant... Quote: Quote: > > > > > Is it normally supposed to be slower than using ftp.exe? Why is this > > > > > so? Quote: Quote: > > > > > --deostroll Quote: Quote: > > > > I ran a few comparisons of ftp.exe versus the async upload code example athttp://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx Quote: Quote: > > > > It's true that the timings are somewhat slower (~40%) using the async > > > > upload. *If you are seeing times increase significantly in your code, I would > > > > look at running your upload code in a console app to eliminate any issues > > > > with your UI update logic. Quote: Quote: > > > > Mike Quote: Quote: > > > As such the ftp-ing (and other stuff) happen on a separate thread in a > > > synchronous manner. The UI update is asynchronous. But its not a > > > direct UI update. I am updating a datatable. My datagridview is bound > > > to the datatable. However I synchronize the updates to this table. Quote: Quote: > > > If I adopted the async solution how will I get the progress updates? Quote: Quote: > > > --deostroll Quote: > > Sorry, I did not mean to imply trying the async method. *I was just trying > > to point out an existing example and the speed of that example relativeto > > ftp.exe. * Quote: > > If your upload times are significantly more than the ftp.exe (like a factor > > of two or more), then it is likely beneficial to time your upload code > > outside of any UI. *If the upload code runs resonably well away from any UI, > > then you've narrowed the areas you need to review in your code. Quote: > > Mike > I should have added, that if you wanted to use the code I referred to above, > you could just add a PercentComplete property to the FtpState class and > monitor that value from some other part of the code which updates the UI. > > Mike Is this the correct way to upload via batch? for (i = 0; i <= TotalChunks; i += 1024) { //Console.WriteLine(i); ftpStream.Write(fileContents, i, 1024); ftpStream.Flush(); } ftpStream.Write(fileContents, 0, fileContents.Length); ftpStream.Flush(); ---------------- Is Flush() known to cause an overhead? --deostroll |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Slow Download & Upload | Network & Sharing | |||
| Extremely Slow Upload Speed to Server 2k3 | Vista networking & sharing | |||
| Slow Upload Speed | Network & Sharing | |||
| SLOW UPLOAD SPEED IN VISTA? | Vista General | |||
| slow upload of music to ipod | Vista hardware & devices | |||