|
Whoops! Cranial-Rectal inversion on my part!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I'm designing a forum system. This has to mantain memory *at least* 50,000 users and 1,000,000 messages. I've build a little test program, that creates those volumes of data. I created it so to create every time different strings. The messages are from 200 to 1,600 char long.
The result is that all this data require less than 5 MB of memory (according to the opinion of Windows TaskManager).
Is this measurement correct?
Any suggestion would be really appreciated.
Thanks
Tozzi is right: Gaia is getting rid of us. Do you feel the way you hate or do you hate the way you feel?
|
|
|
|
|
Do you plan to keep all that data in memory? That won't work, I can tell you that right away. Don't you have a database?
Simple math:
200 characters = 400 byte
times 1,000,000 = 400,000,000 byte = 400 megabyte
1600 characters = 3200 byte
times 1,000,000 = 3,200,000,000 byte = 3.2 gigabyte
So, the messages alone will use somewhere between 400 megabyte and 3.2 gigabyte.
You should use something more accurate than the task manager to measure memory usage, like CLR Profiler.
---
b { font-weight: normal; }
|
|
|
|
|
Actually there is a DB, but I wish to keep as much data as possible in memory to increase performances, expecially because the DB is stored on another machine and the internal network is not really fast because of its existing traffic.
4 MB seemed too little to me also.
Guffa wrote:
You should use something more accurate than the task manager to measure memory usage, like CLR Profiler
I know it, but I haven't nothing like that. Do you know some free Profiler?
Thanks for the help, you made my situation more clear.
Tozzi is right: Gaia is getting rid of us. Do you feel the way you hate or do you hate the way you feel?
|
|
|
|
|
Dario Solera wrote:
Do you know some free Profiler?
CLR Profiler[^]?
|
|
|
|
|
I didn't knew it. Thanks!
Tozzi is right: Gaia is getting rid of us. Do you feel the way you hate or do you hate the way you feel?
|
|
|
|
|
I've understood what is the problem.
The random generated strings, simulating the message body, was not really random, but always the same char sequence. Since the framework optimizes the repeated strings, the memory usage was very low.
Now the test app consumes hundreds MB of memory.
I'm going to develop some kind of buffering system, using self-organizing linked lists to keep in memory the most used data and discard old/unused messages. The data exceeding the memory I can use has necessarily to be read from the DB.
Thanks to all for the help.
Tozzi is right: Gaia is getting rid of us. Do you feel the way you hate or do you hate the way you feel?
|
|
|
|
|
Hey! Is it possible to bind the Ndisprot driver ( used in the RawEthernet example on this site ) to the Microsoft Loopback adapter? When the adapter is installed, the Enumerate adapters method only picks up the "real" ethernet card.
If anyone knows how to do this ( or if its possible ), please let me know.
Thank you very much!
Rick
|
|
|
|
|
i've created a project that has like namespace the name PR_proj
now i want to create a dll that contain a form i can link to my main solution so i can by this one run this dll form and by pressing OK button return some values to the main.
How can create the dll?
Must have the same namespace of the main?
How can use it in my form, that is how do i call it as an internal form?
|
|
|
|
|
Make a new class library. And compile it.
Then include the library, wich is compiled to an DLL and then use it.
You don't have to use the same namespace.
Niklas Ulvinge aka IDK
|
|
|
|
|
how can i compile a class as a dll?
|
|
|
|
|
I think you'll need to start a new project that's a classlibrary. When you compile it it outputs an dll
Niklas Ulvinge aka IDK
|
|
|
|
|
You can also create a dll manually without using VS Studio, i use notepad and batch files for programming and creating a dll is an easy task:
With explorer browse to the folder where your sources (.cs files) are located (the files that your dll will use) and create a text file with notepad and add the following 2 lines to this new file:
csc.exe /target:library /out:MyLibrary.dll *.cs
pause
Save the file, close it and now rename its extension from .txt to .bat, this is a batch file. Now doble click on it (open it) and it will open a DOS window and will start the compiling process. The first line you added to the file will create your dll and the second will prevent the window to close and it will keep it open so you can see the compiler's output in case something goes wrong.
|
|
|
|
|
hi to all,
i have sifted through the many remoting turoials and come up with this basic implementation to understand the workings .. but ...
i changed the RemoteData (public interface method) contents to reflect that it is on another computer, changed to "server says hello", while the local copy is "local copy".
the server RemoteData object is never called, why is this so? it always returns "local copy" when the client is started.
can someone explain this to me please?
sorry about the code tags, but needed for the xml
-------- the server
<code>
using System;
using System.Runtime.Remoting;
using StationUpdate;
namespace SimpleServer
{
/// <summary>
/// The remoting server
/// </summary>
public class RemotingServer
{
public RemotingServer()
{
}
private static RemoteData rd=null;
static void Main(string [] args)
{
RemotingConfiguration.Configure("SimpleServer.exe.config");
rd = new RemoteData();
RemotingServices.Marshal(rd,"RemoteData");
Console.WriteLine("Press return to exit");
Console.ReadLine();
}
}
}
</code>
-------- the server config
<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="8000" />
</channels>
<service>
<wellknown mode="SingleCall" type="Remoting.StationUpdate.RemoteData,Remoting.StationUpdate" objectUri="RemoteData" />
</service>
</application>
</system.runtime.remoting>
</configuration>
</code>
-------- the client
<code>
using System;
using System.Runtime.Remoting;
using StationUpdate;
namespace SimpleClient
{
/// <summary>
/// Summary description for SimpleClient.
/// </summary>
public class SimpleClient
{
public SimpleClient() { }
static void Main(string[] args)
{
RemotingConfiguration.Configure("SimpleClient.exe.config");
RemoteData robj = new RemoteData();
Console.WriteLine(robj.Hello());
Console.ReadLine();
}
}
}
</code>
-------- client config -- pesca is anothe host on my LAN
<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name = "SimpleClient">
<client>
<wellknown type="Remoting.StationUpdate.RemoteData,Remoting.StationUpdate" url="tcp://pesca:8000/RemoteData"/>
</client>
<channels>
<channel ref="tcp" port="0"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
</code>
-------- the remote object
<code>
using System;
using System.Runtime.Remoting.Lifetime;
namespace StationUpdate
{
/// <summary>
/// The remote object
/// </summary>
public class RemoteData : System.MarshalByRefObject
{
public RemoteData()
{
Console.WriteLine("RemoteData Constructor Called");
}
public override object InitializeLifetimeService()
{
return null;
}
public string Hello()
{
//return "server says hello";
return "local copy";
}
}
}
</code>
|
|
|
|
|
i want to know is there any possibility to increase the height of rows of listview control in c# or is there any other customized control on CP that i can use to achieve this purpose.
2nd problem is this i want to add a date time picker control into a column of a list view how can i achieve this plz help me
|
|
|
|
|
Why don't you look at the controls submitted by fellow CPians?
There's even a search function that will lead you to various ListView controls here that are able to do what you want...
mav
|
|
|
|
|
Hi
i need to add an object to crytal report programically . i search msdn and find that can change objects of a report by code but can not find any code to add an object to report
can anyone help me ?
Regards Amir Jalaly
|
|
|
|
|
Can we add a custom expression column to a Typed DataSet to display it in DataGrid? If yes then can you help me with that please? Thanks.
|
|
|
|
|
I have a boolean column in my database and I need my datagrid to show it as a check box insted of "0" or "1". Any ideas how i can do that?
I am using Typed DataSet to populate my datagrid. Thanks
|
|
|
|
|
I am displaying a ComboBox that hopefully contains the contents of a database table (a lookup of sorts). When the form loads, the ComboBox contains the correct values, all sorted.
However, when I try to select a value programitically, I can't (well, I can't select the correct one).
I create a dataset:
DataSet dsTitles = new DataSet("Titles");<br />
SqlCommand tableCommand = new SqlCommand();<br />
tableCommand.CommandText = "select TitleID, TitleDisplayText FROM tblTitles WHERE TitleHidden <> 1";<br />
<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
adapter.SelectCommand = tableCommand;<br />
adapter.Fill(dsTitles, "Titles");
I then bind the dataset to the ComboBox:
comboBoxTitle.BeginUpdate();<br />
comboBoxTitle.DataSource = db.DataSetTitles.Tables["Titles"];<br />
comboBoxTitle.DisplayMember = "TitleDisplayText";<br />
comboBoxTitle.ValueMember = "TitleID";<br />
comboBoxTitle.EndUpdate();
So far, all is well. However, I can't seem to select the correct item. I've tried:
comboBoxTitle.SelectedValue = 2;<br />
Console.WriteLine("Current Title Index: {0} Text: {1} Combo Index: {2} Value: {3} Text: {4}", 2, db.LookupValueTitle(2), comboBoxTitle.SelectedIndex, comboBoxTitle.SelectedValue);<br />
TitleID of 2 matches TitleDisplayText of Mr, but nothing is visibily selected.
Current Title Index: 2 Text: Mr Combo Index: 0 Value: 2 Text: is what gets logged.
Any help would be appreciated.
--G
|
|
|
|
|
Hi,
I've just owned an oldie Dual PentiumIII PC for low profile server and specially for programming.
I just want to take advantage of SMP for my apps and dual procs system really takes advantage from apps only if the apps is programmed to support smp. I don't know if there's a sentence that should be added in my code or is a parameter in the compiler command.
How can i add SMP supports in my C# apps?
Thanx.
Heinz Suez
|
|
|
|
|
Rewrite your app to include multithreading support. It's not something that can just be "turned on" with a switch.
Your application must be able to have parts that that run concurrently. For instance, breaking up a problem and having two threads each work on a seperate part of it. Or, in the case of say, a telnet server, one thread handles one client connection and another threads handles another.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oh, i though it was as simple as turning a switch on with a special syntax in my code or a parameter in the compilation command.
So, you're saying that mi app will automatically detect 2 threads in my code and run each thread with a different processor?
In that case i should play a lot with System.Threading
|
|
|
|
|
No! You have to write your code to support multiple processors! Your code must be written to create it's own threads where appropriate. There is nothing that will do this for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, i'll write my own threads inside my code.
System.Threading namespace is the way to go?
Do i have or can i specify wich processor should handle my thread?
|
|
|
|