|
Hi community!
I've created a simple test application to test data transfer rates when spooling files via remoting and get very strange results.
The client can either fetch a file from the server by calling a remote method
int ReadBuffer(int transferID, ref byte[] buf); until the file has been spooled completely or upload a file to the server by calling the remote method
void WriteBuffer(int transferID, int len, byte[] buf); until all blocks have been tranferred.
Basically what you have to do to spool a file in one direction or the other - can't get any easier, can it?
When I try this in a LAN environment, transfer is as fast as one would expect, but when used over the internet, the results are completely different.
One PC (client) has an ADSL connection: 3072kbit/s download, 384kbit/s upload, the other one (server) has a 2Mbit line up- and downstream.
I had expected the real transfer rates to reflect the asymmetric transfer rates, but upload AND download give me about 30KB/sec, although download should be a lot faster.
The weird thing is:
When I run the server program on the client PC and the client program on the server PC, then the transfer rate server PC -> client PC is up to 74KB/sec!
Copying files with Explorer is as fast as one would expect: ~35KB/sec upload and ~107KB/sec download...
Has someone experienced something similar and knows what the reason could be - or even better - what can I do to get the maximum transfer rates?
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Are you doing any synchronous updates to your UI after reading the buffer? Make sure your reading thread is doing reading only, delegating any other work to other threads.
How many bytes are you transferring per-call? The fewer the bytes, the more calls required, the more overhead, the slower the speed. This would be more apparent in a WAN environment.
mav.northwind wrote: int ReadBuffer(int transferID, ref byte[] buf);
Is that your exact code? I know that some remoting channels don't allow ref and out parameters. Typically when I do things like this, I prefer streams. But that's just a comment, shouldn't have anything to do with your speed problem, I can't imagine.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Is Jesus the Jewish Messiah?
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Thanks for your reply, Judah!
The test program isn't doing any UI updates at all while the transfer is in progress, so that can't be the reason.
I've also tried different block sizes, ranging from 4KB to 256KB. Larger blocks give a little performance increase, but only a few percent - what one would expect if you take the usual remoting overhead into consideration.
I've tried with an out byte[] , but the result was the same. All these results come from a TCP channel with a binary formatter, btw.
I even tried getting the FileStream from the remote server object and then read the bytes directly from this Stream, but to no avail. The download is always slow, even slower than the upload, although the upload bandwidth is approx. 10 times smaller than the download bandwidth.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
|
Seems I've found a workaround, at least.
Instead of using ref byte[] or out byte[] I've tried using byte[] as method return value. This requires a little array copying but gives full speed to the caller.
By adjusting the maximum buffer size I was able to get transfer rates very close to what you can achive when copying a file with Explorer.
Nevertheless, I don't understand why the framework has such poor performance with out or ref byte[] parameters...
But thanks for taking your time!
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
Hi guys,
I would like an exe without any GUI, no forms, no consoles except when I'm in debug mode.
I've tried with using this.Visible = false (true respectively), but it doesn't work. (windows app template) I've also looked into the properties, but couldn't find it (class library template).
Is it possible to have an exe without a GUI?
tnx!
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
V. wrote: Is it possible to have an exe without a GUI?
Yes.
In the Main() method of your application you'll see a line like this:
Application.Run(new SomeFormClass()); Remove that line and the GUI won't get started.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
I should 've thought of that one; although in this case the other solution better fits my needs.
tnx!
Coulda, woulda, shoulda doesn't matter if you don't.
-- modified at 9:01 Monday 24th April, 2006
|
|
|
|
|
I'm curious as to why you only want a GUI in debug mode. It sounds like you are using this as some sort of testing harness. If so, would it not be better to create some repeatable unit tests instead?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
No, We have a core application here at work, where you can plug in other programs. The developers before me, just added an exe for each little Change request, creating a directory full of exe's. If you click one, without the core application started, it will start the application empty (that's not the idea)
I'm making some start to clean up things. One is that I only use 1 exe that will load the appropriate program (In time to be recompiled as dll's, I hope). If no arguments are passed to the exe the GUI will show with an explanation, but if the arguments passed are correct, the user just sees the little program executed, nothing else.
It was the cleanest solution I could think off for the moment .
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
this worked for me in the OnLoad of a form;
this.ShowInTaskbar = false;<br />
this.Opacity = 0;
|
|
|
|
|
thanks I can use this one...
Coulda, woulda, shoulda doesn't matter if you don't.
|
|
|
|
|
please send me a code in c# that allows some IDE tools to click and drag. e.g. textbox,listbox,combobox...etc...
thanks....
|
|
|
|
|
There's three events you need to handle to do this. It's called drag and drop, if you use that terminology, I'm sure google has the details.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
hey howzit.
I am looking for a component that can extract information about fields in a PDF. e.g. their height, width, location etc.
PDF fields are used in electronic forms and are becoming quite popular.
I am looking for a component which is of reasonable price or freeware.
|
|
|
|
|
Hi,
I have a ListView control holding more than 3000 items (which means sorting can take a while). Therefore, I want to display a message saying "Sorting list" while the list is being sorted. The problem is I don't know how to tell when the sorting process has completed.
Any suggestions?
|
|
|
|
|
You might be able to create a thread to sort the items and once that thread has finished then you can say that sorting has finished. You may run into a few problems because I think that using multiple threads to update UIs is messy, your best bet might be to disable the ListView first thus ensuring that the user can't change anything inside it.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
You can show the "Sorting List..." message before performing the sort, and then hide the message after the sort operation completes by doing something like this:
private void btnSortAsc_Click(object sender, System.EventArgs e)
{
this.statusBar1.Text = "Sorting List...";
this.listView1.Sorting = SortOrder.Ascending;
this.statusBar1.Text = "";
}
private void btnSortDesc_Click(object sender, System.EventArgs e)
{
this.statusBar1.Text = "Sorting List...";
this.listView1.Sorting = SortOrder.Descending;
this.statusBar1.Text = "";
}
Josh
|
|
|
|
|
Hi all i have a small problem
I am creating a new blank bitmap in a program, then using the lock bitmap i edit pixels. the Purpose iss to build a spectograph.
Now my problem is that when i create the bitmap
Bitmap pane = new Bitmap(800, 800);
then edit it using pointers the image remains blank
the only work around i could find is initialiazing the bitmap with setpixels one by one.
This is obviously very slow and ive been trying to find a faster way :/
any suggetions ??
|
|
|
|
|
If you posted some code, we could perhaps suggest where it was broken. Obviously, the answer is to lock bits and edit the pixels, so you're doing something wrong. My image processing articles have lots of examples on how to do this, they are on this site, just search for graus and you'll find them
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sure
i Create the bitmap here
Bitmap pane = new Bitmap(800, 800);
then i had to init the bitmap with a colour to get it working
<br />
for (int i = 0; i < pane.Height; i++)<br />
{<br />
for (int j = 0; j < pane.Width; j++)<br />
{<br />
pane.SetPixel(j, i, Color.Black); <br />
<br />
}<br />
<br />
}
basically i have to get rid of the code above
then i use unsafe mode to set colours to individual pixels
public Bitmap backup(Bitmap pane)<br />
{ <br />
BitmapData panedata = pane.LockBits(new Rectangle(0, 0, pane.Width, pane.Height),<br />
ImageLockMode.ReadWrite, pane.PixelFormat);<br />
<br />
int stride = panedata.Stride;
IntPtr Scan0 = panedata.Scan0;<br />
<br />
unsafe<br />
{ <br />
byte* p = (byte*)(void*)Scan0; <br />
<br />
int nOffset = stride - pane.Height *3 ;<br />
int nWidth = pane.Width * 3;<br />
<br />
for (int y = 0; y < pane.Height; ++y)<br />
{<br />
for (int x = 0; x < pane.Width; ++x)<br />
{ <br />
*(p + 0) = (byte)255;<br />
*(p + 1) = (byte)0;<br />
*(p + 2) = (byte)0;<br />
p += 4;<br />
} <br />
}<br />
}<br />
pane.UnlockBits(panedata);<br />
return pane; <br />
}
like that it works but its takes ages to start
|
|
|
|
|
Is there any particular reason you are using pointers to do this? It could be accomplished whithout them. You could tie your bitmap to a graphics object...
Graphics g=Graphics.FromImage(myBmp);
...
then you could fill the image (much faster than indexing)
g.Clear(Color.Black);
Next, I take it you are setting the RGB value of each pixel in your for loop, but you are setting them all to Red as it looks, so why not just use....
g.Clear(Color.Red);
This will work very fast. If this isnt the solution you are needing, let me know,
Aaron
|
|
|
|
|
i pasted only part of the code, the g.clear to fill the bitmap worked nicely just what i needed
and basically im trying to build a spectograph so not every pixel is being drawn and everypixel i draw has a different weight thats why im going tthrough it pixel by pixel.
the program is still in the early stages though thats why it may look a bit raw.
Thanks a lot for your help ! 
|
|
|
|
|
I think you are not seeing any changes because you don't set the alpha value and when it is left to 0 you won't see anything (everything is transparent). Adjust the contents of your inner loop:
*(p + 0) = (byte)255;
*(p + 1) = (byte)0;
*(p + 2) = (byte)0;
*(p + 3) = (byte)255;
p += 4;
|
|
|
|
|