Is MapServer Thread-safe?

Tamas Szekeres szekerest at GMAIL.COM
Tue Jan 22 08:12:14 EST 2008


2008/1/22, Adrian Kruk <adrian.kruk at gmail.com>:
> >The most fundamental components can be used safely right now that are
> >protected with locks.
>
> Safely yes, but with lower performance.
> Function msAcquireLock is called 50 times. Maybe it is possible to try to
> less this number one by one, or better starting from ones which are called
> the most often.
>

I think the thread safety and the performance are not exactly the same
in requirements. If we are targeting the performance to be increased,
then we should have correct measures where are the bottlenecks to be
eliminated. I guess eliminating a few fine grained locks wouldn't give
a big increment in performance in an achitecture with 1 or 2
processors.

Some of the issues would possibly require an alternative solution. For
example to remove the lock around the parser we probably have to
reimplement the parser functionality and eliminate the global
variables around there. However we might want to consider an
alternative solution like supporting binary serialization and
deserialization of the mapObj state for example.

> Can help, but as understand RFC15 has not started yet.
>

yes it hasn't. And the statements might be out of date.

> >- Reviewing all the portions of the mapserver and the dependent libraries code
>
> Is it means that mapserver could has code which you aren't sure that is
> stable in multithreading calls (or you are sure that is unstable and not
> locked)?
>

We're tending to summarize these in the thread safety faq. However
it's slightly outdated and I'm not totally sure about the actual state
of the components enumerated there.

> >- Create test applications that can cover most parts of the
> >mapserver/mapscript code.
> I can create some simpl test application to test mapscript multithreading in
> VS2005 or Mono.
>

That would be cool. Currently the java bindings have a thread test
solution. We should have such tests at the C# part as well.

Best regards,

Tamas



More information about the mapserver-dev mailing list