Continous / CommandLine profiling [v7.4.0.77]

joe123joe123 Posts: 11
Good news : So I finally managed to convince the wallet holders to splurge, and now we have paid licenses for ants - hooray!

Bad news: Now I have to put into practise the wodnerful things I said it could do.

From what I gahtered when I spoke last the continous profiling was semi dropped, or at least has been put ont he backburner, which is a real shame, because that would be a fantastic metric to be able to capture.

As is, what I thought I coudl do meanwhile is if only briefly, be able to remote launch Ants on a production server remotely, stress test the server for 10 or so minutes, tell ants to stop and send myself the files.. seems simple enough.

First issue : OOPS! command line doesnt support debugging IIS.. never mind, you can use a pre-saved project, right? Just have to set up localhost as the default and...

Z:\datos\Visual Studio 2012\Projects\StressTest\StressTest>"C:\Program Files\Red
Gate\ANTS Performance Profiler 7\Profile.exe" /project:ProfileLocalhostProject.app7 /xml:antstmp.xml /csv:antstmp.csv /data:antstmp.app7 /site:0
ANTS Performance Profiler Command Line Utility V7.4.0.77
==============================================================================
Copyright © Red Gate Software Ltd 2010-2012


== Initialising profiler

log4net:WARN XmlHierarchyConfigurator: Unable to set property [securityContext]
on object [log4net.Appender.FileAppender] using value [log4net.Util.NullSecurity
Context.Instance] (with acceptable conversion types)
Will attempt to record SQL and File I/O events for this session
Using the settings from the project file 'ProfileLocalhostProject.app7'
Preparing session
Starting IIS Profiling Host
Initializing ...
Error while starting IIS
Error while starting IIS
Error while trying to launch the application process

Exception
=========

RedGate.Profiler.Engine.Exceptions.CannotStartSessionException:
Could not start IIS.
en ?§♣.↑▬♣.Launch()
en ↓☼♣.¶?☻.►‼(Licence )
en ↓☼♣.¶?☻.??♥(String[] )

Caused by RedGate.Profiler.Engine.Exceptions.CannotStartIisSessionException:
Could not start IIS.
en ?§♣.◄↑♣.§↔♣()
en ?§♣.↑▬♣.Launch()

Caused by RedGate.Profiler.Engine.Exceptions.CannotStartIisSessionException:
Ambiguous site selection. Could not determine which site should be profiled.
en ?→►.↓?►.??♥()
en ?§♣.↑▬♣.??♥(↔←► )
en ?§♣.◄↑♣.§↔♣()

Caused by RedGate.Profiler.Engine.Startup.IIS.IISException:
Ambiguous site selection. Could not determine which site should be profiled.

Server stack trace:
en RedGate.Profiler.Engine.Startup.IIS.IISUtilities.↨⌂♣(Uri )
en RedGate.Profiler.Engine.Startup.IIS.IIS7Utilities.↑⌂♣(Uri )
en RedGate.Profiler.Engine.Startup.IIS.IIS7Utilities.▬⌂♣(Uri )
en ↔▬♣.▲▬♣.StartProfilingIIS(String , String )
en RedGate.Profiler.Engine.Startup.IIS.IISStarter`1.StartProfilingIIS(String
currentUserName, String subprocessVariableValue)
en System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(
IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInCont
ext, Object[]& outArgs)
en System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMes
sage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
en System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
en System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
en RedGate.Profiler.Engine.Startup.IIISActuator`1.StartProfilingIIS(String cu
rrentUserName, String subprocessVariableValue)
en ?→►.↓?►.??♥()


hmm .. " Ambiguous site selection. Could not determine which site should be profiled"
Thats a bummer, as the help /? for the commandline "profile.exe" doesnt seem to have a /site switch.

So.... I guess the question is, how do I go about this? What are my options?

Comments

  • ANTS Profiler tries to work out which site needs to be launched by reading applicationHost.config and trying to match the URL you enter to the bindings in the config file. Whatever URL you have entered doesn't match any site in the config.

    It may be all you need to do is run Profiler as Administrator.

    If that doesn't work, you can try using more specific bindings, ie try reconfiguring the site to bind to a specific TCP port and specify that port in the URL that you supply to ANTS.
  • Ok, fair enough - but the issue is this is being launched from the command line, remotely. So how do I specify a url when the documentation specifically states that I need to use a project file. ( The save as from the main profiling application, I assume).

    The project already has "localhost, restart on same port, port 80 " etc. saved, and as far as I can tell there is no way to override this information in the command line parameters (there isnt even a way to specify you want to profile IIS if you don't use a project file), so the question remains.. If i need to specify which site it refers to... HOW do I do that?
  • You would change the URL by changing it in the project file.

    Also, just to clarify, ANTS will only profile web applications running on the local IIS installation. It can't profile web applications hosted on another server. That could also be the cause of your problem.
  • Sorry I am not being clear. Ants would be installed on the server, so from its POV it would be a local machine.

    However as the Continuous profiling mode still seems to be in beta, or at least not very well publicised, the issue and "solution" we are trying to implement is the following:

    Problem:
    We host and provide web services to various clients who have different peak times of use. We are constantly developing new bits and pieces, and we cannot allow the web service performance to slip, therefore regular stress testing is a necessary evil.
    When we do said testing, we take one production server out of the load balancer, stress it with an in-house program, and then return it to the load balancer none the wiser.

    Aim:
    What we would like to be able to do, is from that in-house program send a message to the server to "start" ants, perform our load testing, collect the results, "stop" ants.

    So basically the same process as before, but with profiling activated. In a way that is automated. I notice the memory profiler has an API for interacting with it, but the performance profiler doesn't seem to ( unless I am just looking in the wrong place).

    My question is, given the tools that are available, how can I accomplish this goal?
  • Looks like we resume with our regularly scheduled program then...

    Can you test the web configuration on that server?
    • download ftp://support.red-gate.com/utilities/re ... runner.zip
    • extract all files to disk
    • right-click redgate.redrum.ui.exe, run as Administrator
    • double-click "double-click to add"
    • click IIS then GetSiteName and enter the URL you pass to ANTS
    • click save, then close
    • click run
    • does the test return a site name, or an error?
  • It returns *A* site name, but not the currently running site. ( in localhost in this particular case they all point to the same port so only one can be active at a time )

    I would upload a screenshot but it would appear I am operating in semi retarded mode today and cant find the button to do so.
  • If both sites are bound to the same port, how is IIS meant to differentiate the two sites? By host header?
  • Well to be fair they arent running simultaneously.

    On a production server, yes I would imagine the host would be the prime differencing factor, but in localhost there basically ISN'T a nice way of dealing with this, so we stop one site and start the other as needed.

    Is there a way to post semi private information? I could send you the <sites> section for the applicationHost.config so you could see what I meant, but I'm not too sure my employers would be amused with me posting said information in a public forum :)
  • I think it is choosing the site it is choosing because it is the last in the list of sites with the same binding information..
    Various sites have this binding info, verbatim:
    <bindings>
    <binding protocol="http" bindingInformation="*:80:" />
    </bindings>

    The currently active site i.e the one I want at the moment has the following information ( and in this case is the first in the list)

    <bindings>
    <binding protocol="http" bindingInformation="*:80:" />
    <binding protocol="net.tcp" bindingInformation="808:*" />
    <binding protocol="net.pipe" bindingInformation="*" />
    <binding protocol="net.msmq" bindingInformation="localhost" />
    <binding protocol="msmq.formatname" bindingInformation="localhost" />
    </bindings>

    Also all the deactivated sites have the attribute
    serverAutoStart="false"

    whereas the active one has
    serverAutoStart="true"


    Of course all this guessing could be avoided if the ants commandline start would just take a /site parameter that could pass in the site id ;P

    Why is it that it is only supported through the ui / project files? Is the setup really that complex?
  • I don't think ANTS is going to work in this sceanrio. It needs to be able to resolve the URL to a set of bindings in IIS.

    I don't think this is strictly the fault of ANTS - all it does is spin up a copy of w3wp.exe, and in order for it to do this it needs a host configuration file that only contains information for one website or w3wp will not start the site. You'd have to remove the ambiguous site from the IIS configuration.

    The other option would be to use the development web server - all that needs is to be shown the website's folder location. It does needa dedicated, unused TCP port, though.
  • That is unfortunate. But bear in mind I am only referring to the command line version - if started from the UI, everything is just peachy, the correct (*only*) site is launched and profiled as expected - so the question is what form of black magic is RedGate.Profiler.UI.exe doing that Profile.exe isn't.

    And assuming there really is no way to do that via command line, Is it possible to publish a list of messages the ui window will respond to so at least we can use the Win32 API / SendMessage to simulate someone pushing the relevant buttons?

    Also.. whatever happened to the continuous profiling mode?
    http://www.red-gate.com/supportcenter/C ... figuration

    no longer seems applicable, or at least I cannot find the " Continuous Profiling Configuration Tool." link
  • I'm not sure why it would work in the UI and not the command line - as far as I know the project code is shared by both... Again, I suspect it may be UAC - applicationHost.config is a protected Windows file.

    Continuous Profiling was an idea hoping to solve all of the problems people have with ANTS trying to launch IIS - it was implemented as an IIS module in the website that collected profiling data continuously and displayed it on another website in the same server.

    Unfortunately it was never technically finished (for instance, no line-level timings, HTTP/SQL profiling, etc) and there was little feedback from users about it, so it looks to have died off.

    We are looking at approaching website profiling in a different way now, which will be more relevant to the problems faced by ASP .NET developers.
Sign In or Register to comment.