BindToCpu - still needed / recommended?


#1

The main application I use is running on a Citrix server, with approximately 20-25 users per server.
Each virtual application server has 6 vCPUs.
The application calls BindToCpu() to bind the application to one of those 6 cpus (randomnly).

However, monitoring the CPU usage shows it flatlining around 25% max CPU during the busiest periods.

I added the BINDTOCPU so long ago, I’m not really sure why and if that reason is still valid. SO my question is:

Is BINDTOCPU still needed for Clarion 10 applications?
Is BINDTOCPU recommended?

Thanks
Alan


#2

I’ve never used it. I have an app on Terminal Services with approx 15 users with no problems at all.


#3

How’s the CPU on your Terminal Services looking?
Does it flatline at all? or does the load spread normally?


#4

I’ve never used it. It was a hack introduced 15 years ago to help some folk who had thread-unsafe code reduces the instances where thread-safety was an issue. Of course making the code thread-safe was a much better idea, but some developers are lazy.

Bruce


#5

Hey, that’s a bit rough. There are legit reason sometimes that these things happen so how about painting with a less broad brush eh?

In fact I seem to recall that it originally came into fashion around the C5 or C5.5 era which coincided with the release of hyperthreaded CPUs and is prior to the C6 threading changes. Maybe the original motivation was to fix or workaround an RTL issue as well?

@Alan_Telford I’m not sure what to suggest other than removing the BindToCpu and seeing what happens. The problem is that the sort of thing that masked is usually hard to replicate on demand and can manifest in unpredictable ways. I guess if you can start out in a non-production environment and see. Maybe your users are willing to have a scheduled load test party where you can monitor what goes on for a short period along with a backup/rollback option in place once the test is complete :slight_smile:


#6

I was being gentle. I was going to say “incompetent or lazy” but went with just lazy.

So, um, doing that in like 1998, and not fixing it since then is, um, not lazy? If it was an issue in 5.5 (I never did it then either) there was certainly no need for it in Clarion 6. Most people just used it as a crutch rather than actually fix their use of global variables. (There - I said “most” not “all”…) Are there legit reasons? I guess if there are I’ve never come across them - but I’ll take your word that they still exist.

I’d suggest making sure that all global variables are marked as THREADed - especially global queues.

cheers
Bruce


#7

My problem was more specifically with the onus on the word “developers” in your statement. I suggest that we default to the idea that all developers would prefer to fix the actual problem and that sometimes reality means that is not always possible. How unfair of you to assume, by default, that anyone is incompetent or lazy.


#8

Thanks for the replies. You’ve confirmed that I almost certainly don’t need it.
I can remember adding it many years ago at the recommendation of either the newsgroup, or ClarionMag.

I have scheduled to remove it early January.


#9

I remember some folks using BindToCPU because of something about the Topspeed driver.

I don’t think laziness or incompetence were pre-requisites in the implementation of this solution. Those are independent attributes.