NetTalk Central

Author Topic: Performance monitoring with two server objects  (Read 3682 times)

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Performance monitoring with two server objects
« on: March 23, 2015, 07:39:27 PM »
Hi, Bruce

Is there any way to do performance monitoring on two NT server objects in the same app? 

Thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Performance monitoring with two server objects
« Reply #1 on: March 23, 2015, 08:54:36 PM »
not easily.

You could of course have 2 web server procedures, running on different threads, listening to different ports.

But I'm curious why you would want 2? If you have http and https then you should redirect all the traffic to https and monitor that one.

cheers
Bruce

CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Performance monitoring with two server objects
« Reply #2 on: March 24, 2015, 01:22:03 PM »
I didn't phrase the the question right.   Can I assign performance monitoring to one server object or the other at run time even if only at server start up?

The context of the problem:
Many, likely a majority,  of our clients don't want to bother with getting a trusted SSL certificates,  and don't want to deal with 'Untrusted certificate' warnings.   They consider the information transferred to be insensitive and not confidential.   You and I might think that is short sighted but it is what they want.   So, we make SSL an optional setting.

I looked at the template code.   With ThisWebServer as the specifed object and ThisSecureServer unspecified,  I went to the ThisSecureServer. TakeEvent method, omitted all the template code referencing ThisWebServer, and replaced it with the same code referencing ThisSecureServer.   Which does indeed provide monitoring for ThisSecureServer.   Trouble is it turns off monitoring for ThisWebServer when SSL is turned off.  So, no different that simply selecting the secure server in the template.  Any workarounds?  Or should I just pick one and leave the other?

Many thanks.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Performance monitoring with two server objects
« Reply #3 on: March 24, 2015, 11:13:11 PM »
ok, that makes sense.

So this is what I'd do;

a) create a variable in the WebServer procedure;

perf_web   &NetWebServer

b) On the Performance extension set

Web Server Object : perf_web

c) In your code assign perf_web to either the secure web server, or the insecure web server....

if client wants SSL
  perf_web & = ThisSecureServer
Else
  perf_web & = ThisWebServer
end


Unfortunately though, while this answers your question, it's completely the wrong way to solve your actual problem. Your actual problem is that you want to make SSL optional to the user hosting the exe.

To do that;

a) on the General tab make the Port number an Expression (say, loc:port where loc:port is the port you want the server to use. This is a really good option anyway for intranet apps because the standard ports may already be in use.)

b) In the WebServer procedure code, ie right click on the procedure and choose Source, search for the line

ThisWebServer.SSL = 1 ! Use SSL to make a Secure Web Server

In the embed straight after that put in

ThisWebServer.SSL = SomeUserSetting

You would set everything up in development as if the site would be SSL - but the user can just turn it off by changing that property.

Oh, and obviously using this approach you only need the one nettalk object in the procedure, not two, so the performance question falls away.

cheers
Bruce



CaseyR

  • Sr. Member
  • ****
  • Posts: 448
    • View Profile
    • Email
Re: Performance monitoring with two server objects
« Reply #4 on: March 27, 2015, 11:56:01 AM »
Thanks, Bruce

I really liked the recommended solution both for its elegance and its maintainability advantages.  Unfortunately, I couldn't get SSL to connect properly with it, so after a few hours fiddling I switched to your first option which works just fine.  Thanks again.