Re: [squid-users] Override Max File Descriptors on Windows

From: Ghassan Gharabli <sounarose_at_googlemail.com>
Date: Sun, 30 Oct 2011 18:14:14 +0200

For now , people can only improve server / system performance by
changing the TIME_WAIT and FILE DESCRIPTOR limit in Windows 2003, XP,
Vista and Windows 2008.

Windows has a hard upper file descriptor limit of 512 at the 'stdio
level' i.e. any program can open a limited number of 512 files
simultaneously at stdio level, but using the C runtime library Windows
hard upper limit for file descriptors can be extended to 2048 i.e. any
program can open upto 2048 number of files simultaneously using the C
runtime 'setmaxstdio' call.

I meant by extending the FD limit If squid requires to open more then
2048 files simultaneously then squid should use the native Win32 API
calls (E.g. CreateFile) instead of C runtime library.

I have succeeded in creating and opening more than 15,000 files
simultaneously by using the Native Win32 API by using (CreateFile,
WriteFile) because Microsoft didnt specify any hard upper limit.

I also have found that when you have internet through Satellite . for
example this software routes the download through the satellite anyway
when you disconnect it then Squid terminates...

2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 1
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 2
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 3
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 4
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 5
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 6
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 7
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 8
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 9
2011/10/29 08:07:38| comm_select: select failure: (10038) WSAENOTSOCK,
Socket operation on nonsocket.
2011/10/29 08:07:38| Select loop Error. Retry 10
FATAL: Select Loop failed!

You also cant use anything else when squid terminates because there
will be no resources available! but Squid as you squid is using NATIVE
WIN32 API for FILE SOCKET so what is happening here ?

On 10/29/11, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 28/10/11 02:38, Ghassan Gharabli wrote:
>> Hello,
>>
>>
>> I am looking for information might help me with your experience!
>>
>>
>> I have compiled Squid 2.7Stable9 on Windows using MinGW and Cygwin but
>> the thing I have already tried to avoid the file descriptors
>> limitation but with no luck anyway . The problem is MinGW is linking
>> with msvcrt.dll on Windows and I am being forced to get max fd as
>> 2048 on Windows .. so Is there anyway I can compile Squid Under
>> something to override FD definitions! .
>>
>>
>> I spent few days searching for the source code of msvcrt.dll so I can
>> edit the max 2048 but still no luck . Does anyone know who can direct
>> me to someone who might get the source code of msvcrt.dll and that
>> would be the best idea to improve performance on Windows or else I
>> need to work on changing the Squid Windows I/O .
>>
>> Something like replacing the use of the POSIX I/O interfaces in mysys
>> on Windows with the Win32 API calls (CreateFile, WriteFile, etc). All
>> that I know , the Windows API does not support opening files in append
>> mode in all cases.
>>
>
> The day when network I/O on Windows supports POSIX enough that it can be
> done via CreateFile/WriteFile or some equivalent will be a happy day for
> many programmers around the world currently having to keep two sets of
> FD flying.
>
> Windows FS in Squid uses the native Win32 Overlapping I/O thread
> interfaces for disk access whenever that is available. The FD limit is
> not related to that.
>
> The 2048 FD limit (actually 2048 _handle_ limit per process) is built
> into the select() algorithm. It affects POSIX as well as Windows. But
> Windows support in Squid does not exist for any of the more advanced
> network I/O methods.
>
> See comm_*.c for available comm modules. The ones with a Win32 API
> version have a win32 suffix.
> If you want to develop a new I/O module that works through some other
> Windows API for more FD and/or faster operation we are keen to see the
> results.
>
> Note: that any new submissions will be applied upstream against
> Squid-3.HEAD. But the nature of the comm I/O modules currently makes
> them easily ported between the two Squid versions with few changes. So
> you can develop on Squid-2 and port after its proven working.
>
> PS. Please contact squid-dev mailing list for more detailed help and
> developer assistance. This is an admin focussed help list.
>
> Amos
> --
> Please be using
> Current Stable Squid 2.7.STABLE9 or 3.1.16
> Beta testers wanted for 3.2.0.13
>
Received on Sun Oct 30 2011 - 16:14:22 MDT

This archive was generated by hypermail 2.2.0 : Sun Oct 30 2011 - 12:00:03 MDT