Running GUI application in separate application domain

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nickdu

    Running GUI application in separate application domain

    I'm trying to isolate "applicatio ns" into their own application domain within
    a single process. I've quoted applications because it's a logical
    representation of an application. Basically it consists of a bunch of
    components supplied by some application group. I got this to work, somewhat.
    The problem is that the application performs roughly (and this has not been
    measured, but a guess based on the rendering of the application GUI) 10x
    slower than a similar (almost identical) application in which all of the
    components are created within the main (/default) application domain. Is
    there some inherent performance problem with running GUI applications in
    separate application domains?

    By the way, I'm also posting this to the dotnet framework clr newsgroup.
    --
    Thanks,
    Nick
  • nickdu

    #2
    RE: Running GUI application in separate application domain

    I've got some additional information. Via configuration I was able to move
    all these components into a single application domain, separate from the
    default domain. The performance of this matches the performance of the
    existing application where all the components are in the default domain. In
    both of these scenarios I noticed the % Time in GC is around 7%. When these
    components are spread across two application domains the % Time in GC is
    around 20% and as I mentioned the performance appears to be about 10x worse.
    I'm running the application from my laptop which is a single processor
    machine. Why would separating the work of a single application to multiple
    application domains have such a drastic change on the GC?
    --
    Thanks,
    Nick


    "nickdu" wrote:
    [color=blue]
    > I'm trying to isolate "applicatio ns" into their own application domain within
    > a single process. I've quoted applications because it's a logical
    > representation of an application. Basically it consists of a bunch of
    > components supplied by some application group. I got this to work, somewhat.
    > The problem is that the application performs roughly (and this has not been
    > measured, but a guess based on the rendering of the application GUI) 10x
    > slower than a similar (almost identical) application in which all of the
    > components are created within the main (/default) application domain. Is
    > there some inherent performance problem with running GUI applications in
    > separate application domains?
    >
    > By the way, I'm also posting this to the dotnet framework clr newsgroup.
    > --
    > Thanks,
    > Nick[/color]

    Comment

    • John Murray

      #3
      Re: Running GUI application in separate application domain

      I suspect that most of your problem is related to Marshalling the
      objects across the app domains. The additional objects that are needed
      to create this and the proxies could the additional GC work that needs
      to occurs.





      nickdu wrote:[color=blue]
      > I've got some additional information. Via configuration I was able to move
      > all these components into a single application domain, separate from the
      > default domain. The performance of this matches the performance of the
      > existing application where all the components are in the default domain. In
      > both of these scenarios I noticed the % Time in GC is around 7%. When these
      > components are spread across two application domains the % Time in GC is
      > around 20% and as I mentioned the performance appears to be about 10x worse.
      > I'm running the application from my laptop which is a single processor
      > machine. Why would separating the work of a single application to multiple
      > application domains have such a drastic change on the GC?[/color]

      Comment

      • nickdu

        #4
        Re: Running GUI application in separate application domain

        What marshaling? All the components are created in their appdomain. There
        should be no marshaling going on.

        Also, forget my last post. I ran it again with all the components in one
        appdomain, other than the main appdomain, and the performance was very poor.
        I guess the first time I tried that was just some sort of fluke. Though I
        don't believe in flukes. My guess is that something is screwed up and most
        of the time it's screwed up in the same way which causes the performance
        problem.
        --
        Thanks,
        Nick


        "John Murray" wrote:
        [color=blue]
        > I suspect that most of your problem is related to Marshalling the
        > objects across the app domains. The additional objects that are needed
        > to create this and the proxies could the additional GC work that needs
        > to occurs.
        >
        >
        >
        >
        >
        > nickdu wrote:[color=green]
        > > I've got some additional information. Via configuration I was able to move
        > > all these components into a single application domain, separate from the
        > > default domain. The performance of this matches the performance of the
        > > existing application where all the components are in the default domain. In
        > > both of these scenarios I noticed the % Time in GC is around 7%. When these
        > > components are spread across two application domains the % Time in GC is
        > > around 20% and as I mentioned the performance appears to be about 10x worse.
        > > I'm running the application from my laptop which is a single processor
        > > machine. Why would separating the work of a single application to multiple
        > > application domains have such a drastic change on the GC?[/color]
        >[/color]

        Comment

        • nickdu

          #5
          Re: Running GUI application in separate application domain

          By the way, I talk about performance but I guess some may be confused about
          what I mean. The components are grid components (classes derived from the
          SyncFusion grid) which are displaying real-time data updates over a TIB bus.
          When these same components are all run in the default application domain the
          application can keep up with the real-time updates. When I create two of the
          grids in one appdomain and two in another the performance decreases
          drastically.

          --
          Thanks,
          Nick


          "nickdu" wrote:
          [color=blue]
          > What marshaling? All the components are created in their appdomain. There
          > should be no marshaling going on.
          >
          > Also, forget my last post. I ran it again with all the components in one
          > appdomain, other than the main appdomain, and the performance was very poor.
          > I guess the first time I tried that was just some sort of fluke. Though I
          > don't believe in flukes. My guess is that something is screwed up and most
          > of the time it's screwed up in the same way which causes the performance
          > problem.
          > --
          > Thanks,
          > Nick
          >
          >
          > "John Murray" wrote:
          >[color=green]
          > > I suspect that most of your problem is related to Marshalling the
          > > objects across the app domains. The additional objects that are needed
          > > to create this and the proxies could the additional GC work that needs
          > > to occurs.
          > >
          > >
          > >
          > >
          > >
          > > nickdu wrote:[color=darkred]
          > > > I've got some additional information. Via configuration I was able to move
          > > > all these components into a single application domain, separate from the
          > > > default domain. The performance of this matches the performance of the
          > > > existing application where all the components are in the default domain. In
          > > > both of these scenarios I noticed the % Time in GC is around 7%. When these
          > > > components are spread across two application domains the % Time in GC is
          > > > around 20% and as I mentioned the performance appears to be about 10x worse.
          > > > I'm running the application from my laptop which is a single processor
          > > > machine. Why would separating the work of a single application to multiple
          > > > application domains have such a drastic change on the GC?[/color]
          > >[/color][/color]

          Comment

          • David Levine

            #6
            Re: Running GUI application in separate application domain

            I'm not sure if this applies to your situation...the re is a limitation in
            the current BCL that prevents GUI components from being instantiated in
            separate appdomains and that are all hosted in a GUI framework running in
            its own appdomain. In other words, you cannot share GUI components across
            appdomains. It's not that everything does not work, but some important
            aspects don't work right. You can run a GUI framework in an appdomain other
            then the default and have it host other GUI components, so long as all the
            GUI pieces are all running in the same appdomain. You can share non-GUI
            components across appdomain boundaries without apparent problems (otherwise
            remoting would be completely useless). This may be related to the
            performance problem you are seeing.


            "nickdu" <nickdu@discuss ions.microsoft. com> wrote in message
            news:E9209AD2-0F3E-4882-A8F8-3A7BB35FF6F4@mi crosoft.com...[color=blue]
            > By the way, I talk about performance but I guess some may be confused
            > about
            > what I mean. The components are grid components (classes derived from the
            > SyncFusion grid) which are displaying real-time data updates over a TIB
            > bus.
            > When these same components are all run in the default application domain
            > the
            > application can keep up with the real-time updates. When I create two of
            > the
            > grids in one appdomain and two in another the performance decreases
            > drastically.
            >
            > --
            > Thanks,
            > Nick
            >
            >
            > "nickdu" wrote:
            >[color=green]
            >> What marshaling? All the components are created in their appdomain.
            >> There
            >> should be no marshaling going on.
            >>
            >> Also, forget my last post. I ran it again with all the components in one
            >> appdomain, other than the main appdomain, and the performance was very
            >> poor.
            >> I guess the first time I tried that was just some sort of fluke. Though
            >> I
            >> don't believe in flukes. My guess is that something is screwed up and
            >> most
            >> of the time it's screwed up in the same way which causes the performance
            >> problem.
            >> --
            >> Thanks,
            >> Nick
            >>
            >>
            >> "John Murray" wrote:
            >>[color=darkred]
            >> > I suspect that most of your problem is related to Marshalling the
            >> > objects across the app domains. The additional objects that are needed
            >> > to create this and the proxies could the additional GC work that needs
            >> > to occurs.
            >> >
            >> >
            >> >
            >> >
            >> >
            >> > nickdu wrote:
            >> > > I've got some additional information. Via configuration I was able
            >> > > to move
            >> > > all these components into a single application domain, separate from
            >> > > the
            >> > > default domain. The performance of this matches the performance of
            >> > > the
            >> > > existing application where all the components are in the default
            >> > > domain. In
            >> > > both of these scenarios I noticed the % Time in GC is around 7%.
            >> > > When these
            >> > > components are spread across two application domains the % Time in GC
            >> > > is
            >> > > around 20% and as I mentioned the performance appears to be about 10x
            >> > > worse.
            >> > > I'm running the application from my laptop which is a single
            >> > > processor
            >> > > machine. Why would separating the work of a single application to
            >> > > multiple
            >> > > application domains have such a drastic change on the GC?
            >> >[/color][/color][/color]


            Comment

            • nickdu

              #7
              Re: Running GUI application in separate application domain

              I'm hoping it's not related as I'm not attempting to share components across
              appdomains.
              --
              Thanks,
              Nick


              "David Levine" wrote:
              [color=blue]
              > I'm not sure if this applies to your situation...the re is a limitation in
              > the current BCL that prevents GUI components from being instantiated in
              > separate appdomains and that are all hosted in a GUI framework running in
              > its own appdomain. In other words, you cannot share GUI components across
              > appdomains. It's not that everything does not work, but some important
              > aspects don't work right. You can run a GUI framework in an appdomain other
              > then the default and have it host other GUI components, so long as all the
              > GUI pieces are all running in the same appdomain. You can share non-GUI
              > components across appdomain boundaries without apparent problems (otherwise
              > remoting would be completely useless). This may be related to the
              > performance problem you are seeing.
              >
              >
              > "nickdu" <nickdu@discuss ions.microsoft. com> wrote in message
              > news:E9209AD2-0F3E-4882-A8F8-3A7BB35FF6F4@mi crosoft.com...[color=green]
              > > By the way, I talk about performance but I guess some may be confused
              > > about
              > > what I mean. The components are grid components (classes derived from the
              > > SyncFusion grid) which are displaying real-time data updates over a TIB
              > > bus.
              > > When these same components are all run in the default application domain
              > > the
              > > application can keep up with the real-time updates. When I create two of
              > > the
              > > grids in one appdomain and two in another the performance decreases
              > > drastically.
              > >
              > > --
              > > Thanks,
              > > Nick
              > >
              > >
              > > "nickdu" wrote:
              > >[color=darkred]
              > >> What marshaling? All the components are created in their appdomain.
              > >> There
              > >> should be no marshaling going on.
              > >>
              > >> Also, forget my last post. I ran it again with all the components in one
              > >> appdomain, other than the main appdomain, and the performance was very
              > >> poor.
              > >> I guess the first time I tried that was just some sort of fluke. Though
              > >> I
              > >> don't believe in flukes. My guess is that something is screwed up and
              > >> most
              > >> of the time it's screwed up in the same way which causes the performance
              > >> problem.
              > >> --
              > >> Thanks,
              > >> Nick
              > >>
              > >>
              > >> "John Murray" wrote:
              > >>
              > >> > I suspect that most of your problem is related to Marshalling the
              > >> > objects across the app domains. The additional objects that are needed
              > >> > to create this and the proxies could the additional GC work that needs
              > >> > to occurs.
              > >> >
              > >> >
              > >> >
              > >> >
              > >> >
              > >> > nickdu wrote:
              > >> > > I've got some additional information. Via configuration I was able
              > >> > > to move
              > >> > > all these components into a single application domain, separate from
              > >> > > the
              > >> > > default domain. The performance of this matches the performance of
              > >> > > the
              > >> > > existing application where all the components are in the default
              > >> > > domain. In
              > >> > > both of these scenarios I noticed the % Time in GC is around 7%.
              > >> > > When these
              > >> > > components are spread across two application domains the % Time in GC
              > >> > > is
              > >> > > around 20% and as I mentioned the performance appears to be about 10x
              > >> > > worse.
              > >> > > I'm running the application from my laptop which is a single
              > >> > > processor
              > >> > > machine. Why would separating the work of a single application to
              > >> > > multiple
              > >> > > application domains have such a drastic change on the GC?
              > >> >[/color][/color]
              >
              >
              >[/color]

              Comment

              • nickdu

                #8
                Re: Running GUI application in separate application domain

                I just ran some more tests and captured perfmon logs for the two different
                scenarios. When I run the GUI components in the default app domain I get the
                following results (I only lists the ones that are significantly different and
                could potentially indicate the problem).

                ..NET CLR Security\Total Runtime Checks: Min=122,443 Max=358,890 Delta=~236,000
                ..NET CLR Memory\# Gen 0 Collections: Min=149 Max=9927 Delta=~9800
                ..NET CLR Memory\% Time in GC: Average=6
                ..NET CLR Memory\Allocate d Bytes/sec: Average=12MB
                ..NET CLR Memory\Finaliza tion Survivors: Average=344

                The same counters for the scenario where the components are run in an
                appdomain different from the default domain is:

                ..NET CLR Security\Total Runtime Checks: Min=124,677 Max=1,475,320 Delta=~1.3M
                ..NET CLR Memory\# Gen 0 Collections: Min=762 Max=69,766 Delta=~69,000
                ..NET CLR Memory\% Time in GC: Average=17
                ..NET CLR Memory\Allocate d Bytes/sec: Average=32MB
                ..NET CLR Memory\Finaliza tion Survivors: Average=38

                For for some reason running these components in a different application
                domain drastically increased the # of runtime security checks, # of gen 0
                collections, % Time in GC, and the allocated bytes/sec. Note that the server
                which generates the real time data feed is the same in both cases.

                Any ideas?
                --
                Thanks,
                Nick


                "nickdu" wrote:
                [color=blue]
                > I'm hoping it's not related as I'm not attempting to share components across
                > appdomains.
                > --
                > Thanks,
                > Nick
                >
                >
                > "David Levine" wrote:
                >[color=green]
                > > I'm not sure if this applies to your situation...the re is a limitation in
                > > the current BCL that prevents GUI components from being instantiated in
                > > separate appdomains and that are all hosted in a GUI framework running in
                > > its own appdomain. In other words, you cannot share GUI components across
                > > appdomains. It's not that everything does not work, but some important
                > > aspects don't work right. You can run a GUI framework in an appdomain other
                > > then the default and have it host other GUI components, so long as all the
                > > GUI pieces are all running in the same appdomain. You can share non-GUI
                > > components across appdomain boundaries without apparent problems (otherwise
                > > remoting would be completely useless). This may be related to the
                > > performance problem you are seeing.
                > >
                > >
                > > "nickdu" <nickdu@discuss ions.microsoft. com> wrote in message
                > > news:E9209AD2-0F3E-4882-A8F8-3A7BB35FF6F4@mi crosoft.com...[color=darkred]
                > > > By the way, I talk about performance but I guess some may be confused
                > > > about
                > > > what I mean. The components are grid components (classes derived from the
                > > > SyncFusion grid) which are displaying real-time data updates over a TIB
                > > > bus.
                > > > When these same components are all run in the default application domain
                > > > the
                > > > application can keep up with the real-time updates. When I create two of
                > > > the
                > > > grids in one appdomain and two in another the performance decreases
                > > > drastically.
                > > >
                > > > --
                > > > Thanks,
                > > > Nick
                > > >
                > > >
                > > > "nickdu" wrote:
                > > >
                > > >> What marshaling? All the components are created in their appdomain.
                > > >> There
                > > >> should be no marshaling going on.
                > > >>
                > > >> Also, forget my last post. I ran it again with all the components in one
                > > >> appdomain, other than the main appdomain, and the performance was very
                > > >> poor.
                > > >> I guess the first time I tried that was just some sort of fluke. Though
                > > >> I
                > > >> don't believe in flukes. My guess is that something is screwed up and
                > > >> most
                > > >> of the time it's screwed up in the same way which causes the performance
                > > >> problem.
                > > >> --
                > > >> Thanks,
                > > >> Nick
                > > >>
                > > >>
                > > >> "John Murray" wrote:
                > > >>
                > > >> > I suspect that most of your problem is related to Marshalling the
                > > >> > objects across the app domains. The additional objects that are needed
                > > >> > to create this and the proxies could the additional GC work that needs
                > > >> > to occurs.
                > > >> >
                > > >> >
                > > >> >
                > > >> >
                > > >> >
                > > >> > nickdu wrote:
                > > >> > > I've got some additional information. Via configuration I was able
                > > >> > > to move
                > > >> > > all these components into a single application domain, separate from
                > > >> > > the
                > > >> > > default domain. The performance of this matches the performance of
                > > >> > > the
                > > >> > > existing application where all the components are in the default
                > > >> > > domain. In
                > > >> > > both of these scenarios I noticed the % Time in GC is around 7%.
                > > >> > > When these
                > > >> > > components are spread across two application domains the % Time in GC
                > > >> > > is
                > > >> > > around 20% and as I mentioned the performance appears to be about 10x
                > > >> > > worse.
                > > >> > > I'm running the application from my laptop which is a single
                > > >> > > processor
                > > >> > > machine. Why would separating the work of a single application to
                > > >> > > multiple
                > > >> > > application domains have such a drastic change on the GC?
                > > >> >[/color]
                > >
                > >
                > >[/color][/color]

                Comment

                • nickdu

                  #9
                  Re: Running GUI application in separate application domain

                  I'm pretty certain is has to do with Security Runtime Checks. When I turn
                  Code Access Security off (caspol -s off) the performance is fine and of
                  course the runtime security checks perfmon counter is zero.

                  This is where some of the confusion comes in. When CAS is turned on
                  sometimes the performance is good and sometimes it isn't. However, ever
                  since I've started looking at the security runtime checks performance counter
                  I've noticed that every time the performance is slow I'm doing huge amounts
                  of runtime security checks. On the order of 3200/sec. When CAS is on and
                  the peformance is good the runtime security checks counter is much lower,
                  maybe 300/sec - 500/sec. I can't figure out why sometimes this counter will
                  be high and other times it will be low for the same assemblies. I've
                  literally ran the program once and noticed poor performance and then ran the
                  same program again (no changes) and noticed good performance. Again, the
                  poor performing run was generating loads of runtime security checks and the
                  good performing run was not.
                  --
                  Thanks,
                  Nick


                  "nickdu" wrote:
                  [color=blue]
                  > I just ran some more tests and captured perfmon logs for the two different
                  > scenarios. When I run the GUI components in the default app domain I get the
                  > following results (I only lists the ones that are significantly different and
                  > could potentially indicate the problem).
                  >
                  > .NET CLR Security\Total Runtime Checks: Min=122,443 Max=358,890 Delta=~236,000
                  > .NET CLR Memory\# Gen 0 Collections: Min=149 Max=9927 Delta=~9800
                  > .NET CLR Memory\% Time in GC: Average=6
                  > .NET CLR Memory\Allocate d Bytes/sec: Average=12MB
                  > .NET CLR Memory\Finaliza tion Survivors: Average=344
                  >
                  > The same counters for the scenario where the components are run in an
                  > appdomain different from the default domain is:
                  >
                  > .NET CLR Security\Total Runtime Checks: Min=124,677 Max=1,475,320 Delta=~1.3M
                  > .NET CLR Memory\# Gen 0 Collections: Min=762 Max=69,766 Delta=~69,000
                  > .NET CLR Memory\% Time in GC: Average=17
                  > .NET CLR Memory\Allocate d Bytes/sec: Average=32MB
                  > .NET CLR Memory\Finaliza tion Survivors: Average=38
                  >
                  > For for some reason running these components in a different application
                  > domain drastically increased the # of runtime security checks, # of gen 0
                  > collections, % Time in GC, and the allocated bytes/sec. Note that the server
                  > which generates the real time data feed is the same in both cases.
                  >
                  > Any ideas?
                  > --
                  > Thanks,
                  > Nick
                  >
                  >
                  > "nickdu" wrote:
                  >[color=green]
                  > > I'm hoping it's not related as I'm not attempting to share components across
                  > > appdomains.
                  > > --
                  > > Thanks,
                  > > Nick
                  > >
                  > >
                  > > "David Levine" wrote:
                  > >[color=darkred]
                  > > > I'm not sure if this applies to your situation...the re is a limitation in
                  > > > the current BCL that prevents GUI components from being instantiated in
                  > > > separate appdomains and that are all hosted in a GUI framework running in
                  > > > its own appdomain. In other words, you cannot share GUI components across
                  > > > appdomains. It's not that everything does not work, but some important
                  > > > aspects don't work right. You can run a GUI framework in an appdomain other
                  > > > then the default and have it host other GUI components, so long as all the
                  > > > GUI pieces are all running in the same appdomain. You can share non-GUI
                  > > > components across appdomain boundaries without apparent problems (otherwise
                  > > > remoting would be completely useless). This may be related to the
                  > > > performance problem you are seeing.
                  > > >
                  > > >
                  > > > "nickdu" <nickdu@discuss ions.microsoft. com> wrote in message
                  > > > news:E9209AD2-0F3E-4882-A8F8-3A7BB35FF6F4@mi crosoft.com...
                  > > > > By the way, I talk about performance but I guess some may be confused
                  > > > > about
                  > > > > what I mean. The components are grid components (classes derived from the
                  > > > > SyncFusion grid) which are displaying real-time data updates over a TIB
                  > > > > bus.
                  > > > > When these same components are all run in the default application domain
                  > > > > the
                  > > > > application can keep up with the real-time updates. When I create two of
                  > > > > the
                  > > > > grids in one appdomain and two in another the performance decreases
                  > > > > drastically.
                  > > > >
                  > > > > --
                  > > > > Thanks,
                  > > > > Nick
                  > > > >
                  > > > >
                  > > > > "nickdu" wrote:
                  > > > >
                  > > > >> What marshaling? All the components are created in their appdomain.
                  > > > >> There
                  > > > >> should be no marshaling going on.
                  > > > >>
                  > > > >> Also, forget my last post. I ran it again with all the components in one
                  > > > >> appdomain, other than the main appdomain, and the performance was very
                  > > > >> poor.
                  > > > >> I guess the first time I tried that was just some sort of fluke. Though
                  > > > >> I
                  > > > >> don't believe in flukes. My guess is that something is screwed up and
                  > > > >> most
                  > > > >> of the time it's screwed up in the same way which causes the performance
                  > > > >> problem.
                  > > > >> --
                  > > > >> Thanks,
                  > > > >> Nick
                  > > > >>
                  > > > >>
                  > > > >> "John Murray" wrote:
                  > > > >>
                  > > > >> > I suspect that most of your problem is related to Marshalling the
                  > > > >> > objects across the app domains. The additional objects that are needed
                  > > > >> > to create this and the proxies could the additional GC work that needs
                  > > > >> > to occurs.
                  > > > >> >
                  > > > >> >
                  > > > >> >
                  > > > >> >
                  > > > >> >
                  > > > >> > nickdu wrote:
                  > > > >> > > I've got some additional information. Via configuration I was able
                  > > > >> > > to move
                  > > > >> > > all these components into a single application domain, separate from
                  > > > >> > > the
                  > > > >> > > default domain. The performance of this matches the performance of
                  > > > >> > > the
                  > > > >> > > existing application where all the components are in the default
                  > > > >> > > domain. In
                  > > > >> > > both of these scenarios I noticed the % Time in GC is around 7%.
                  > > > >> > > When these
                  > > > >> > > components are spread across two application domains the % Time in GC
                  > > > >> > > is
                  > > > >> > > around 20% and as I mentioned the performance appears to be about 10x
                  > > > >> > > worse.
                  > > > >> > > I'm running the application from my laptop which is a single
                  > > > >> > > processor
                  > > > >> > > machine. Why would separating the work of a single application to
                  > > > >> > > multiple
                  > > > >> > > application domains have such a drastic change on the GC?
                  > > > >> >
                  > > >
                  > > >
                  > > >[/color][/color][/color]

                  Comment

                  Working...