Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
16
Erster Beitrag:
vor 5 Jahren, 4 Monaten
Letzter Beitrag:
vor 5 Jahren, 4 Monaten
Beteiligte Autoren:
Arie, Bart VDE, Peter Holemans, Viggo Poulsen, Mariano Saul, Fabrice Harari, GuenterP, Geoff B

Using client PC as HF database server

Startbeitrag von Bart VDE am 08.02.2013 07:44

Hi all,

I have a customer who have a LAN with 3 PC's (W7 64-bit). I have to install my program on the 3 PC's.

Now I have the choice of using HF classic or HF/CS. In the last case, I have to install the manta server on one of the client PC's.

I wonder whats the best way in that case. Is it "done" to install one client PC as database server or is it better to use HF classic over the LAN.

Thx !

Antworten:

Hi Bart,

HF/CS would be the way forward since it is much more optimised regarding network usage.
I only recommend classic for single machine applications or for data that is local to the machine the app is running on. I have some applications that have HF/CS for all that is common and separate classic tables locally for local stuff.

Notice that in your case the machine with the db (classic or CS) needs to be always running and that is a single point of failure (e.g. disk crash). You may consider a fourth machine like an HP Microserver with 2 mirrored disks (RAID1) to host the database server (somewhere around 500€ I believe).

Just my 2 cents,

P.

von Peter Holemans - am 08.02.2013 08:17
Hi Bart,

in principle, there's not a lot of a difference between these two 'solutions'. If the user PC with the database on it is turned off - no access for the others. If that user 'decides' to delete the database or to kill the hardware by moving it harschly or even knocking it over etc?

Suggestion: Why not install the HF C/S database on a virtual (linux)-server of a provider on the web or even better, on a root server? Makes sense insofar that your customer can have regular and automatic data backup there. For a few Euros more per month you can get an additional databackup-service of the provider. Virtual servers are cheap. The advantage: the database is accessible over the web from anywhere and from any laptop. See:
http://www.windev.at/html/hfsql_c_s_on_linux.html

Kind regards,
Guenter

von GuenterP - am 08.02.2013 08:32
We have dozens of POS system running this way, with one hfcs as the main/server.
No problem what so ever.

The FIC files remain the same, so in case you want to return to hfclassic, it is just a matter of changing the connection parameters and copy the files.

Another advantage could be, to have access to the data from outside, i.e. home.
Just open port 4900 (or whatever port you choose for hfcs) on the firewall.

To get the full benefit of CS you must use queries in certain situations.
HReadxxx functions read the whole record (except for the the blob fields in most cases).
So if you just need a few fields from hundreds of records (for a file with let's say 25+ fields), you better use queries and just read these specific fields.
For inidvidual records it doesn't make much difference, I think. As long as the data fits into a single network package.
This is just an example. It all depends on the structure of you file. Text-fields or numeric-fields. Are all textfields filled with data, etc.

von Arie - am 08.02.2013 08:39
Hi All,

I agree with Günter and have most of my HF/CS db's on Win2008R2 VPS (Virtual Private Server) on the internet. But... You'll have to adapt your coding style a bit to get this to work in a performant way (e.g. use queries in all cases, don't use direcly linked tables etc...) aside from a broadband connection of course.

Cheers,

Peter H.

von Peter Holemans - am 08.02.2013 08:39
Hey,

Thanks for the replies.

I know that it's not a ideal situation, but for the moment an extra server is for my customer a no-go I'm afraid. They know the about the risc in case of a crash of the "server"-PC.

I just think about the performance of the "server" pc : will it not slowing down to much acting as db-server ? Will the performance be as good as HF classic ?

von Bart VDE - am 08.02.2013 09:01
Hi Bart

the performance will be better with HFCS, even on a 'local' pc...

Best regards

von Fabrice Harari - am 08.02.2013 12:49
OK, thanks !

von Bart VDE - am 08.02.2013 15:22
Quote
Arie Mars

To get the full benefit of CS you must use queries in certain situations.
HReadxxx functions read the whole record (except for the the blob fields in most cases).
So if you just need a few fields from hundreds of records (for a file with let's say 25+ fields), you better use queries and just read these specific fields.
For inidvidual records it doesn't make much difference, I think. As long as the data fits into a single network package.
This is just an example. It all depends on the structure of you file. Text-fields or numeric-fields. Are all textfields filled with data, etc.


Hi Arie,

I'm new to WD, but my understanding is that HFCS is still an ISAM database, it just has a server to handle remote requests? So what benefit is there in using queries, the whole record(s) is (are) still going to be read and returned to the requester?

Thanks,

Geoff B

von Geoff B - am 09.02.2013 02:20
Geoff,
when using queries you can ask for the fields you need, instead of getting all fields.
Of course the server still has to read the info, maybe getting the whole record from disk, yes.
But it is designed to do this job, using caching, query plans and so on.
This is why Fabrice says, using the hfcs in a single machine situation could even give better perfomance .
But it certainly improves speed when in comes to (slow) networks and in multi user environments.

von Arie - am 09.02.2013 11:09
My suggestions are:

Go for HFCS.

Choose the PC that is going to act as the server to be the one that is faster (more ram or faster hard disk).

In case the PC are all the same choose the one that is going to be used less.

Place a note somewhere on the server that says "Don't turn off unless you know what you are doing".

Use queries and program accordingly.

Enjoy it ;)

Mariano

von Mariano Saul - am 09.02.2013 12:01
Bart,
because you have an existing application, I would just change the connection and see what happens.
The advices mentioned here about queries are not a must. Your app will work nevertheless. I would only replace code with query-like-code, when you experience performance issues.
Opening an edit-window to edit a single customers record: no need for queries.
Using a window with a list/table control, showing a fair amount of records: use queries.

von Arie - am 09.02.2013 14:04
Hi

One question about queries: If I programmable make a query in my server code (not in the analyze) will it be optimized automatically or do I have to define the query in the analyze to get the speed improvement ?

Best regards
Viggo Poulsen

von Viggo Poulsen - am 10.02.2013 09:39
Viggo
I am not sure if I understand your question.
With "server code" do you mean stored procedures or are you talking about webdev server code?
Anyway: for performance it doesn't make any difference. You need proper indexes on your tables to get performance. And define links between tables, so the query engine can calculate the best execution plan.
If I am right with V18 one can see/examine query plans.

von Arie - am 10.02.2013 15:11
Hi Arie

So many possibilities, I see I need to be more specific :-)
What I mean is, WebDev 17 server code like this:
Build a string with the sql statement.
IF HExecuteSQLQuery(QRY, hQueryDefault, sMyQry) THEN .........

Best regards
Viggo Poulsen

von Viggo Poulsen - am 10.02.2013 18:49
I see, well I don't think it makes any difference using a "homebrewed" query or "designed" ones. They are both just queries to be handled by the hfcs sql engine.

von Arie - am 10.02.2013 19:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.