PDA

Click to See Complete Forum and Search --> : A server pc?


sterankin
Jul 30th, 2003, 08:58 AM
I am creating a db application with vb. Is it sensible to store the database on a separate computer (server?)


Basically, 5 or 6 different computers will be reading and writing to the database. So can I just put the db in a high spec tower pc? And then the other PCs can access it via ethernet/LAN?


What sort of spec would u advise for the server pc? Anything it requires?

Thx

wrack
Jul 30th, 2003, 10:37 PM
First of all, you need to understand that this is not 2 tier app u r talking about and so u need to be very careful in what kinda objects u use and how u use it.

A server with a 1 GHz of power and 512 MB of RAM should do.

sterankin
Jul 31st, 2003, 03:07 AM
First of all, you need to understand that this is not 2 tier app u r talking about and so u need to be very careful in what kinda objects u use and how u use it.


Could you expand on that?

Thanks

wrack
Jul 31st, 2003, 03:55 AM
Sure can.

What you are talking about is a 3 tier application. In that kind of apps database sits on server and there is a DLL which contains all the logic stuff.

Now here comes a good part. In normal application you declare a connection object and open it once or twice or as many times as u need but usually it's open all the time and so it's a global connection object. In 3 tier app the same thing could eat all the memory of ur server.

So u should have an app which have a forms but none of the objects required to interactrs with server should be declared globally or at module level. Try to use them at procedural level and destroy them as soon as you are finished with it.

For example you declare a recordset called rsSearch at the general declaration section on form and so the moment you refer to that form or show that form rsSearch is initialized and it will use 4 Bytes of a memory. Keep in mind that you haven't even opened it or used it. But that 4 Bytes are just a reference to the original recordset object and the original object could take 1000 Bytes plus the amount of records it will contain, kinda buffer.

Now this object will only destroyed when u close the form and set the forms reference to nothing. But how many times you are likely to use search function. So what you do is when user clicks on search button you open a connection, open a recordset, do search, display a result, close recordset, set it to nothing, close the connection and set it to nothing. Looks like a bit long process but if u don't do it then you are screwed since it will use heaps of memory until you close the form.

Solution is to declare the connection object and recordset objects in the search button's event and use them for the life span of clicking that button.

Sometimes you have to use global variable so if you can't avoid them then use but keep it limited. Now the whole situation gets worst when 10 users connects and uses it. It could take 50 - 500 MB of RAM depending on the design of the app.

While in real life over load of opening & closing connections and recordset on the processor is very low comparing the usage of RAM.

Now my fingers hurt while typing but I think you are smart enough to userstand what I am talking about. Hope to be helpful.

Conclusion a server with P III 1.13 GHz and 512 MB of RAM will do just fine. I have seen apps consuming 2 GB of RAM doing nothing.

Cheers.