Thread View: borland.public.interbase.opensource
6 messages
6 total messages
Started by Jack Mason
Sun, 26 Nov 2006 23:24
Hyperthreading
Author: Jack Mason
Date: Sun, 26 Nov 2006 23:24
Date: Sun, 26 Nov 2006 23:24
17 lines
1564 bytes
1564 bytes
All of the dual core boards to which we have access have no way to disable hyperthreading. Interbase 6 is not the only program that we have seen that has problems running with hyperthreading, but so far all the others are doing program installations. If we run the Interbase server on another system, everything works fine. Starting the server on the dual core system seems to go well. It is just when one opens a database on the server running on a dual core system that it takes forever and a day. Are there any plans to solve this problem? Is there any way we can fix it ourselvers? If not, guess we will have to continue to run with older boards for the servers as long as they are available. Does the latest version from Borland have the same problem? Thanks
Re: Hyperthreading
Author: Bill Todd
Date: Sun, 26 Nov 2006 22:55
Date: Sun, 26 Nov 2006 22:55
31 lines
2373 bytes
2373 bytes
Jack Mason wrote: > All of the dual core boards to which we have access have no way to > disable hyperthreading. Interbase 6 is not the only program that we > have seen that has problems running with hyperthreading, but so far > all the others are doing program installations. > > If we run the Interbase server on another system, everything works > fine. Starting the server on the dual core system seems to go well. > It is just when one opens a database on the server running on a dual > core system that it takes forever and a day. This may be due to multiple processors, a problem Microsoft introduced in their TCP/IP stack in XP and Win2k or a combination of the two. There is a freeware program called IBAffinity that you can use to pin IB to a single processor. That will solve the problem of Windows constantly swapping IB from one processor to another to try to balance the load. > > Are there any plans to solve this problem? Not in the open source version of InterBase. Borland abandoned the open source version years ago and returned to developing InterBase as a commercial product. The current version is InterBase 2007 (8.0) which supports hyperthreading, multiple processors, the TCP/IP problem mentioned above and includes a host of new features added in versions 6.5, 7, 7.5 and 2007. -- Bill Todd (TeamB)
Re: Hyperthreading
Author: Jack Mason
Date: Mon, 27 Nov 2006 00:06
Date: Mon, 27 Nov 2006 00:06
1 lines
948 bytes
948 bytes
Thanks, Bill. We will try the IBAffinity thing.
Re: Hyperthreading
Author: AntonE
Date: Sun, 31 Dec 2006 18:22
Date: Sun, 31 Dec 2006 18:22
11 lines
1338 bytes
1338 bytes
For windows NT/2000/XP get imagecfg by google'ing for it & run: imagecfg -a 0x1 C:\Program Files\Borland\interbase\Bin\ibserver.exe That will permanently fix the Affinity to one 'CPU' without needing to run IBAffinity after startup. "Jack Mason" <jackmason@mindspring.com> wrote in message news:456a2c0c$1@newsgroups.borland.com... > Thanks, Bill. We will try the IBAffinity thing.
Re: Hyperthreading
Author: Olivier Pons
Date: Fri, 26 Jan 2007 08:36
Date: Fri, 26 Jan 2007 08:36
278 lines
9463 bytes
9463 bytes
There's a utility that works perfectly here. Here's the source code :
just compile, then run it ;)
------------------------------------------------------------------------------------------------------------------------------------------------
What is IB_AFFINITY for?
------------------------
IB_AFFINITY is a console mode program that you can use to control the
affinity
mask of the running IBServer.exe process. That means you can predict on
which
processor in your multiprocessor machine IBServer is allowed to run.
IB_AFFINITY does run on Windows NT only, not on Win-9x where multiple
processors aren't supported anyway. The program was compiled with
Delphi-4 (UP3)
and tested on Windows NT-4 (SP5) with IB5.5.
Command line switches:
----------------------
-Q Query current affinity mask
Display the current affinity mask of IBServer.exe and the entire system
before
change.
-An New Affinity mask n (decimal) to set
(n AND system_mask) is the new mask to apply.
-N Dont try to enable SeDebugPrivilege
When you want to change the affinity mask of IBServer runnin as NT
service, you
need the debug privilege. The Administrator account has this privilege by
default. IB_AFFINITY tries to enable this privilege unless you specify
-N. If
you don't have the debug privilege you can for example use -Q -N to
query the
masks without changing them or you can use -An -N to change the
affinity mask of IBServer running as taskbar program.
-Rn,m Retry up to n times with m milliseconds delay to locate IBServer This
option is useful in batches that start IBServer or IBGuardian and modify the
affinity mask of IBServer immediately after. Under high load NT might
not have
finished to create the IBServer process when IB_AFFINITY starts. The retry
option is useful to wait for the IBServer process to be instanciated. An
value
of -R10,10000 is recommended, but will of course delay the return of
this tool
by 100 seconds if IBServer is really not started.
Example 1:
----------
C:\> IB_AFFINITY -Q
Current affinity mask: System=15, IBServer=15
This means you have four system processors installed (15 dec = 1111 bin) and
IBServer is allowed to utilize all four processors.
Example 2:
----------
C:\> IB_AFFINITY -Q -A12
Current affinity mask: System=15, IBServer=15
Affinity mask set to 12
C:\> IB_AFFINITY -Q
Current affinity mask: System=15, IBServer=12
This changes the affinity mask of the IBServer process to 12 (= 1100
bin), so
the process is allowed to run on the system processors 3 and 4.
Disclaimer:
-----------
IB_AFFINITY is freeware. The sourcecode is available. It comes to you AS-IS.
Use it or do not use it, but if you use is, you do it on your own risk.
Author: Karsten Strobel
email : ait-augsburg@t-online.de
Date : 26-JUN-1999
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
program IB_AFFINITY;
{$APPTYPE CONSOLE}
{ Compiled with Delphi4 (UP3) }
uses Windows, Sysutils;
var
MaskToSet: Integer = 0;
SetMask: Boolean = false;
QueryMask: Boolean = false;
NoDebugPrivilege: Boolean = false;
ib_hwnd: THandle = 0;
ib_processid: DWORD = 0;
ib_processh: THandle = 0;
own_token: THandle = 0;
process_affmask: DWORD = 0;
sys_affmask: DWORD = 0;
RetryCountdown: Integer = 0;
RetryDelay: Integer = 0;
function EnumWindowsProc(hwnd: THandle; lParam: DWORD): Boolean; stdcall;
var
s: string;
i: Integer;
begin
SetLength(s, 256);
i := GetWindowText(hwnd, @(s[1]), 256);
SetLength(s, i);
Result := s <> 'InterBase Server';
if not Result then ib_hwnd := hwnd;
end;
function MyAdjustTokenPrivileges(TokenHandle: THandle;
DisableAllPrivileges: BOOL;
const NewState: TTokenPrivileges; BufferLength: DWORD;
PreviousState: PTokenPrivileges; ReturnLength: PDWORD): BOOL; stdcall;
external advapi32 name 'AdjustTokenPrivileges';
function EnablePrivilege(h: THandle; AName: string; AState: Boolean):
Boolean;
var
tp: TTokenPrivileges;
begin
Result := false;
if not LookupPrivilegeValue(nil, PChar(AName), tp.Privileges[0].Luid)
then Exit;
tp.PrivilegeCount := 1;
if AState then tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
else tp.Privileges[0].Attributes := 0;
Result := MyAdjustTokenPrivileges(h, false, tp, SizeOf(tp), nil, nil);
end;
procedure PrintHelp;
begin
writeln('With IB_AFFINITY you can control the affinity mask of the
IBServer process.');
writeln('IB_AFFINITY is freeware and comes AS-IS. Use it on your own
risk.');
writeln('IB_AFFINITY has been tested with Interbase V5.5 on Windows
NT4.');
writeln('V1.1, Author: Karsten Strobel');
writeln;
writeln('Available switches:');
writeln(' -Q Query current affinity mask');
writeln(' -An New Affinity mask n (decimal) to set');
writeln(' -N Don''t try to enable SeDebugPrivilege');
writeln(' -Rn,m Retry up to n times with m millisec. delay to
locate IBServer');
writeln;
Halt(1);
end;
var
i, j, k: Integer;
s: string;
begin
try
//eval cmdline switches
for i := 1 to ParamCount do
begin
s := UpperCase(ParamStr(i));
if s[1] <> '-' then PrintHelp;
case s[2] of
'A': begin
Delete(s, 1, 2);
MaskToSet := StrToIntDef(s, -1);
if (MaskToSet <= 0) or SetMask then PrintHelp;
SetMask := true;
end;
'Q': begin
if (Length(s) > 2) or QueryMask then PrintHelp;
QueryMask := true;
end;
'N': begin
if (Length(s) > 2) or NoDebugPrivilege then PrintHelp;
NoDebugPrivilege := true;
end;
'R': begin
Delete(s, 1, 2);
k := Pos(',', s);
if k = 0 then PrintHelp;
j := StrToIntDef(copy(s, 1, k-1), -1);
k := StrToIntDef(copy(s, k+1, Length(s)), -1);
if (j <= 0) or (k < 0) or (RetryCountdown > 0) then PrintHelp;
RetryCountdown := j;
RetryDelay := k;
end;
else
PrintHelp;
end;
end;
if not (SetMask or QueryMask) then PrintHelp;
//check NT is running
if Win32Platform <> VER_PLATFORM_WIN32_NT then
raise Exception.Create('IB_AFFINITY requires Windows NT.');
//find running IBServer
repeat
EnumWindows(@EnumWindowsProc, 0);
if (ib_hwnd <> 0) or (RetryCountdown <= 0) then system.break;
Sleep(RetryDelay);
Dec(RetryCountdown);
until false;
if ib_hwnd = 0 then
raise Exception.Create('Unable to find IBServer process. Not
running?');
if GetWindowThreadProcessId(ib_hwnd, @ib_processid) = 0 then
RaiseLastWin32Error;
//enable SeDebugPrivilege
//(needed to be able to set affinity mask if IBServer runs as
service using the system account)
if not NoDebugPrivilege then
begin
Win32Check(OpenProcessToken(GetCurrentProcess,
TOKEN_ADJUST_PRIVILEGES, own_token));
Win32Check(EnablePrivilege(own_token, 'SeDebugPrivilege', true));
end;
//get handle of IBServer process
i := PROCESS_QUERY_INFORMATION;
if SetMask then i := i or PROCESS_SET_INFORMATION;
ib_processh := OpenProcess(i, false, ib_processid);
if ib_processh = 0 then RaiseLastWin32Error;
try
//query current affinity mask
Win32Check(GetProcessAffinityMask(ib_processh, process_affmask,
sys_affmask));
if QueryMask then
writeln(Format('Current affinity mask: System=%d, IBServer=%d',
[sys_affmask, process_affmask]));
//set new affinity mask
if SetMask then
begin
Win32Check(SetProcessAffinityMask(ib_processh, MaskToSet and
sys_affmask));
writeln(Format('Affinity mask set to %d', [MaskToSet and
sys_affmask]));
end;
finally
CloseHandle(ib_processh);
end;
except
on E:Exception do
begin
s := E.Message + #13#10;
WriteFile(GetStdHandle(STD_ERROR_HANDLE), s[1], Length(s),
DWORD(i), nil);
ExitCode := 1;
end;
end;
end.
Re: Hyperthreading
Author: AntonE
Date: Fri, 02 Mar 2007 21:02
Date: Fri, 02 Mar 2007 21:02
292 lines
10212 bytes
10212 bytes
or just find imagecfg.exe & run the command:
imagecfg -a 0x1 "C:\Program Files\Borland\interbase\Bin\ibserver.exe"
then you'll be fixed up after reboot as well. (You might have to stop the
server before running it)
enjoy.
"Olivier Pons" <olivier.dot.pons.at.gmaildot.com@ignore.this.fr> wrote in
message news:45b9bd4b$1@newsgroups.borland.com...
> There's a utility that works perfectly here. Here's the source code : just
> compile, then run it ;)
> ------------------------------------------------------------------------------------------------------------------------------------------------
> What is IB_AFFINITY for?
>
> ------------------------
>
> IB_AFFINITY is a console mode program that you can use to control the
> affinity
> mask of the running IBServer.exe process. That means you can predict on
> which
> processor in your multiprocessor machine IBServer is allowed to run.
>
> IB_AFFINITY does run on Windows NT only, not on Win-9x where multiple
> processors aren't supported anyway. The program was compiled with Delphi-4
> (UP3)
> and tested on Windows NT-4 (SP5) with IB5.5.
>
> Command line switches:
>
> ----------------------
>
> -Q Query current affinity mask
>
> Display the current affinity mask of IBServer.exe and the entire system
> before
> change.
>
> -An New Affinity mask n (decimal) to set
>
> (n AND system_mask) is the new mask to apply.
>
> -N Dont try to enable SeDebugPrivilege
>
> When you want to change the affinity mask of IBServer runnin as NT
> service, you
> need the debug privilege. The Administrator account has this privilege by
> default. IB_AFFINITY tries to enable this privilege unless you specify -N.
> If
> you don't have the debug privilege you can for example use -Q -N to query
> the
> masks without changing them or you can use -An -N to change the
>
> affinity mask of IBServer running as taskbar program.
>
> -Rn,m Retry up to n times with m milliseconds delay to locate IBServer
> This
> option is useful in batches that start IBServer or IBGuardian and modify
> the
> affinity mask of IBServer immediately after. Under high load NT might not
> have
> finished to create the IBServer process when IB_AFFINITY starts. The retry
> option is useful to wait for the IBServer process to be instanciated. An
> value
> of -R10,10000 is recommended, but will of course delay the return of this
> tool
> by 100 seconds if IBServer is really not started.
>
> Example 1:
>
> ----------
>
> C:\> IB_AFFINITY -Q
>
> Current affinity mask: System=15, IBServer=15
>
> This means you have four system processors installed (15 dec = 1111 bin)
> and
> IBServer is allowed to utilize all four processors.
>
> Example 2:
>
> ----------
>
> C:\> IB_AFFINITY -Q -A12
>
> Current affinity mask: System=15, IBServer=15
>
> Affinity mask set to 12
>
> C:\> IB_AFFINITY -Q
>
> Current affinity mask: System=15, IBServer=12
>
> This changes the affinity mask of the IBServer process to 12 (= 1100 bin),
> so
> the process is allowed to run on the system processors 3 and 4.
>
> Disclaimer:
>
> -----------
>
> IB_AFFINITY is freeware. The sourcecode is available. It comes to you
> AS-IS.
> Use it or do not use it, but if you use is, you do it on your own risk.
>
> Author: Karsten Strobel
>
> email : ait-augsburg@t-online.de
>
> Date : 26-JUN-1999
>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> program IB_AFFINITY;
>
> {$APPTYPE CONSOLE}
>
> { Compiled with Delphi4 (UP3) }
>
> uses Windows, Sysutils;
>
> var
> MaskToSet: Integer = 0;
> SetMask: Boolean = false;
> QueryMask: Boolean = false;
> NoDebugPrivilege: Boolean = false;
> ib_hwnd: THandle = 0;
> ib_processid: DWORD = 0;
> ib_processh: THandle = 0;
> own_token: THandle = 0;
> process_affmask: DWORD = 0;
> sys_affmask: DWORD = 0;
> RetryCountdown: Integer = 0;
> RetryDelay: Integer = 0;
>
> function EnumWindowsProc(hwnd: THandle; lParam: DWORD): Boolean; stdcall;
> var
> s: string;
> i: Integer;
> begin
> SetLength(s, 256);
> i := GetWindowText(hwnd, @(s[1]), 256);
> SetLength(s, i);
> Result := s <> 'InterBase Server';
> if not Result then ib_hwnd := hwnd;
> end;
>
> function MyAdjustTokenPrivileges(TokenHandle: THandle;
> DisableAllPrivileges: BOOL;
> const NewState: TTokenPrivileges; BufferLength: DWORD;
> PreviousState: PTokenPrivileges; ReturnLength: PDWORD): BOOL; stdcall;
> external advapi32 name 'AdjustTokenPrivileges';
>
> function EnablePrivilege(h: THandle; AName: string; AState: Boolean):
> Boolean;
> var
> tp: TTokenPrivileges;
> begin
> Result := false;
> if not LookupPrivilegeValue(nil, PChar(AName), tp.Privileges[0].Luid)
> then Exit;
> tp.PrivilegeCount := 1;
> if AState then tp.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED
> else tp.Privileges[0].Attributes := 0;
> Result := MyAdjustTokenPrivileges(h, false, tp, SizeOf(tp), nil, nil);
> end;
>
> procedure PrintHelp;
> begin
> writeln('With IB_AFFINITY you can control the affinity mask of the
> IBServer process.');
> writeln('IB_AFFINITY is freeware and comes AS-IS. Use it on your own
> risk.');
> writeln('IB_AFFINITY has been tested with Interbase V5.5 on Windows
> NT4.');
> writeln('V1.1, Author: Karsten Strobel');
> writeln;
> writeln('Available switches:');
> writeln(' -Q Query current affinity mask');
> writeln(' -An New Affinity mask n (decimal) to set');
> writeln(' -N Don''t try to enable SeDebugPrivilege');
> writeln(' -Rn,m Retry up to n times with m millisec. delay to locate
> IBServer');
> writeln;
> Halt(1);
> end;
>
> var
> i, j, k: Integer;
> s: string;
> begin
> try
> //eval cmdline switches
> for i := 1 to ParamCount do
> begin
> s := UpperCase(ParamStr(i));
> if s[1] <> '-' then PrintHelp;
> case s[2] of
> 'A': begin
> Delete(s, 1, 2);
> MaskToSet := StrToIntDef(s, -1);
> if (MaskToSet <= 0) or SetMask then PrintHelp;
> SetMask := true;
> end;
> 'Q': begin
> if (Length(s) > 2) or QueryMask then PrintHelp;
> QueryMask := true;
> end;
> 'N': begin
> if (Length(s) > 2) or NoDebugPrivilege then PrintHelp;
> NoDebugPrivilege := true;
> end;
> 'R': begin
> Delete(s, 1, 2);
> k := Pos(',', s);
> if k = 0 then PrintHelp;
> j := StrToIntDef(copy(s, 1, k-1), -1);
> k := StrToIntDef(copy(s, k+1, Length(s)), -1);
> if (j <= 0) or (k < 0) or (RetryCountdown > 0) then PrintHelp;
> RetryCountdown := j;
> RetryDelay := k;
> end;
> else
> PrintHelp;
> end;
> end;
> if not (SetMask or QueryMask) then PrintHelp;
>
> //check NT is running
> if Win32Platform <> VER_PLATFORM_WIN32_NT then
> raise Exception.Create('IB_AFFINITY requires Windows NT.');
>
> //find running IBServer
> repeat
> EnumWindows(@EnumWindowsProc, 0);
> if (ib_hwnd <> 0) or (RetryCountdown <= 0) then system.break;
> Sleep(RetryDelay);
> Dec(RetryCountdown);
> until false;
>
> if ib_hwnd = 0 then
> raise Exception.Create('Unable to find IBServer process. Not
> running?');
> if GetWindowThreadProcessId(ib_hwnd, @ib_processid) = 0 then
> RaiseLastWin32Error;
>
> //enable SeDebugPrivilege
> //(needed to be able to set affinity mask if IBServer runs as service
> using the system account)
> if not NoDebugPrivilege then
> begin
> Win32Check(OpenProcessToken(GetCurrentProcess,
> TOKEN_ADJUST_PRIVILEGES, own_token));
> Win32Check(EnablePrivilege(own_token, 'SeDebugPrivilege', true));
> end;
>
> //get handle of IBServer process
> i := PROCESS_QUERY_INFORMATION;
> if SetMask then i := i or PROCESS_SET_INFORMATION;
> ib_processh := OpenProcess(i, false, ib_processid);
> if ib_processh = 0 then RaiseLastWin32Error;
> try
> //query current affinity mask
> Win32Check(GetProcessAffinityMask(ib_processh, process_affmask,
> sys_affmask));
> if QueryMask then
> writeln(Format('Current affinity mask: System=%d, IBServer=%d',
> [sys_affmask, process_affmask]));
> //set new affinity mask
> if SetMask then
> begin
> Win32Check(SetProcessAffinityMask(ib_processh, MaskToSet and
> sys_affmask));
> writeln(Format('Affinity mask set to %d', [MaskToSet and
> sys_affmask]));
> end;
> finally
> CloseHandle(ib_processh);
> end;
>
> except
> on E:Exception do
> begin
> s := E.Message + #13#10;
> WriteFile(GetStdHandle(STD_ERROR_HANDLE), s[1], Length(s), DWORD(i),
> nil);
> ExitCode := 1;
> end;
> end;
> end.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads