Grid performance terribly slow on a file share, browse works well

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
mol
Posts: 3028
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 169 times
Been thanked: 92 times
Contact:

Re: Grid performance terribly slow on a file share, browse works well

Post by mol » Wed Oct 04, 2017 8:34 pm

I'm using netio server to get data from .dbf files, because windows sharing does not work well (terrible very slow).
Netio solution is great!

franco
Posts: 251
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Wed Feb 07, 2018 7:04 pm

I am using a browse to look up inventory items for my grid. I have a textbox to type into to update the browse.
windows sharing.
This works well on a workstation if server is not in use, but is really to slow when server starts to do anything.
In this dbf table there are 150,000 items and I use a ntx index. This is almost unusable.... Any thoughts,
Franco

trmpluym
Posts: 227
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 5 times
Been thanked: 19 times

Post by trmpluym » Wed Feb 07, 2018 7:22 pm

Hi Franco,

I also struggled with this performance problem. Here how i solved the problem:

1. The Browse control is much faster than the Grid control
2. Use LetoDB ( http://www.kresin.ru/en/letodb.html ) this works fantastic !

Theo

User avatar
mol
Posts: 3028
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 169 times
Been thanked: 92 times
Contact:

Post by mol » Wed Feb 07, 2018 7:34 pm

I've changed my applications to work with NETIO server.
After few modifications inside Windows, samba protocol causes a lot of performance problems.

trmpluym
Posts: 227
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 5 times
Been thanked: 19 times

Post by trmpluym » Wed Feb 07, 2018 8:03 pm

Hi Marek,

I also first tried NETIO but LetoDB is much, much faster.

You should try it. And (like NETIO) the required source modifications are minimal.

Theo

franco
Posts: 251
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Wed Feb 07, 2018 10:00 pm

Theo, I am lost when adding things like this. Can you help me. Ido not know where to start.
Thanks, Franco

franco
Posts: 251
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sat Feb 10, 2018 6:48 pm

Here is a small sample of my problem. When there are 1000 items not to much problem but when large table big problem.
If you compile this and run on one computer it runs good, but if you map a network drive from another computer to computer
where program is and is already running in the grid it is really unusable.

******* PROBLEM RESOLVED WITH FOLLOWING REVISED CODE *****

Code: Select all

#include <hmg.ch>

Function Main
OPNFLS()
	DEFINE WINDOW Form_1 ;
		AT 0,0 ;
		WIDTH 1000 ;
		HEIGHT 610 ;
		TITLE 'Browse Test' ;
		MAIN 
		
		@10,10 BUTTON Button_1 CAPTION 'Browse' WIDTH 75 HEIGHT 75 MULTILINE ;
		         NOTABSTOP TOOLTIP 'Browse Inv' ;
				 ACTION { || BRWCRS(87, 228, 220, 100, 390, 'ITEM', 'OH ', "INV", 'NUM1', 'NUM2') }

		
			END WINDOW

	CENTER WINDOW Form_1

	ACTIVATE WINDOW Form_1

Return
////////////////////// This I put in its own program and can use from any other procedure by 
////////////////////// Opening the files set the indexes and send the above parameters

function brwcrs

LOCAL WID1, OSEL
PRIVATE NORD := INDEXORD()            /// TO RESET THE INDEXES ON RETURN
PARAMETERS R1, C1, W1, W2, H1, H2, H3, T1, FC1, FC2      // TA, W1, W2, C1, R1, H1, I1, D1, FC1, FC2
// R1 = ROW.... C1 = COLUMN.... W1 = WIDTH OD FIRST FIELD.... W2 = WIDTH OF SECOND FIELD
// H1 = HEIGHT.... H2 = HEADER 1.... H3 = HEADER 2.... T1 = TABLE.... FC1 = FIELD1.... FC2 = FIELD 2
///////////////////// REVISED
IF RECCOUNT() > 1000          //THIS IS FOR WHEN USING BROWSE FOR MORE THAN ONE PROGRAM.. 1000 SEEMS TO SLOW TERMINAL
	 CREATEFOLDER("C:\TEMP")
	INDEX ON NUM1 TO C:\TEMP\BRSINV      // THIS WORKS 1.5 SECOND TO CREATE INDEX ON 800000 RECORDS
ENDIF
//////////////////////////////////////// I HAVE TRIED UP TO 800000 RECORDS VERY FAST

IF W2 = 0
   WID1 := 'FC1'
ELSE 
   WID1 := 'FC1 , FC2'
ENDIF  
DEFINE WINDOW frmQSMain ;
AT  R1+80, C1+10 ;
WIDTH W1+W2+40 ;      //GetDesktopWidth() * 0.75 ;
HEIGHT H1+20 ;  // GetDesktopHeight() * 0.75 ;
WINDOWTYPE CHILD ;
TITLEBAR .F. 

  ON KEY ESCAPE ACTION { || MKEY := .T., Goo6() }                 //frmQSMain.Release}


DEFINE BROWSE brwItems
ROW 0     //133
COL 0     //211
WIDTH W1 + W2+25  // 400
HEIGHT H1  //290
BACKCOLOR    { 255, 255, 255}
FONTCOLOR { 0, 0, 0 }
HEADERS  {H2 , H3}
WIDTHS   {W1, W2}
WORKAREA  &T1 //inv
FIELDS { &WID1}
ONDBLCLICK { || dbgoto(this.value), Goo6()    }            //frmQSMain.Release  }
ONLOSTFOCUS { || dbgoto(this.value),Goo6()  }           // frmQSMain.Release } 
ONCHANGE { || dbgoto(this.value) }
TOOLTIP 'Press Escape to Exit'
NOLINES .F.
END BROWSE // brwItems

DEFINE TEXTBOX textSearch
ROW 1 //R1
COL 1  //232
WIDTH 1 // 200 can make 1 so you cannot see
HEIGHT 24
ONCHANGE { || DBSEEK( UPPER( this.Value ), .T. ), frmQSMain.brwItems.value := &T1->(RECNO() ) }
ONENTER { || frmQSMain.brwItems.SETFOCUS }
ONLOSTFOCUS { || frmQSMain.brwItems.SETFOCUS}
END TEXTBOX // tbxSearch
END WINDOW // frmQSMain  

frmQSMain.textSEARCH.SETFOCUS
frmQSMain.Activate
return
////////////////////////////////// End of browse program 

FUNCTION OPNFLS
LOCAL CF
if ! file('inv.dbf')
	CF := {}
	aADD(CF,{'NUM1'       ,'C' , 15,0})
	aADD(CF,{'NUM2'       ,'C' , 15,0})

	DBCREATE( 'INV.DBF',CF )
	USE
   
   USE INV EXCLUSIVE NEW 
	INDEX ON NUM1 TO NUM1
	DO WHILE RECNO()< 100000
	INV->( DBAPPEND())
	INV->( FIELDPUT(1, 'P'+ALLTRIM(STR(20+RECNO())) ))
	INV->( FIELDPUT(2, 'PARTS' ))

	LOOP
	ENDDO
	USE
ENDIF

SELECT 1
USE INV SHARED
SET INDEX TO NUM1

RETURN

FUNCTION GOO6
LOCAL OLDREC := RECNO()
SET ORDER TO NORD
DBGOTO(OLDREC)
frmQSMain.Release
RETURN

This is what I am now using.
Thanks Franco ;)
Last edited by franco on Tue Feb 13, 2018 5:52 am, edited 3 times in total.

User avatar
serge_girard
Posts: 2077
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 427 times
Been thanked: 91 times
Contact:

Post by serge_girard » Sat Feb 10, 2018 9:17 pm

Franco,

Suggestion: (I didn't try out , yet) create index on local.

Maybe this helps

Serge

franco
Posts: 251
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Been thanked: 9 times

Post by franco » Sat Feb 10, 2018 9:56 pm

Hi Serge,
Can we create a index into local memory, then when finished and closing tables, release the index.
I map network drive, then go to drive and send the exe to desktop. so tables are in main drive but program in this computer, so when going into invoicing program I would have to create a local index on all local computers.
I am running in (say z: drive) and index in c: drive or local memory.
I wonder if create a temp file does it go into memory. if so I can create a temp index for that file , then select my inventory file and index it to the temp index. ?? might work.
Thanks Franco

User avatar
serge_girard
Posts: 2077
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 427 times
Been thanked: 91 times
Contact:

Post by serge_girard » Sat Feb 10, 2018 10:15 pm

Right! Just try it! And let me know.

Serge

Post Reply