Skip to content

Conversation

@forki
Copy link
Contributor

@forki forki commented Dec 29, 2016

@vasily-kirichenko
Copy link
Contributor

Great! :)

@cartermp
Copy link
Contributor

What does memory/CPU consumption look like with this change?

Copy link
Contributor

@KevinRansom KevinRansom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

@KevinRansom KevinRansom merged commit 6638ed3 into dotnet:master Dec 29, 2016
let checker =
lazy
let checker = FSharpChecker.Create()
let checker = FSharpChecker.Create(projectCacheSize = 200, keepAllBackgroundResolutions = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I've always been very skeptical about this huge project cache size used by VFPT. It is much, much, much bigger than that used previously by Visual F# Tools (3 projects).

I know @vasily-kirichenko thinks differently though - but I just wanted to highlight that this setting doesn't feel instinctively right to me, and my gut intuition is that it will lead to OOM in VS too often. We need a methodology to test operational memory usage on typical scenarios such as 5-10 very large projects, or hundreds of small projects.

Some information on Roslyn's choices here may also be useful - how much semantic analysis information does Roslyn keep live, and what policies/techniques are used to manage that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I would very much like to see this setting be user-settable, or at least controlled by an environment variable or something. Given the major features added in VS2017, I feel it's inevitable that we will get reports that the F# support now uses more memory (and hence becomes unusable more often). We really need to be able to do on-machine diagnosis and treatment when that happens.

Copy link
Contributor

@dsyme dsyme Dec 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I suppose the immediately safe thing is to remove the 200 setting - since there's discussion about whether it's a definite improvement in all scenarios, whereas keepAllBackgroundResolutions is agreed to always be an improvement).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsyme in https://github.com/Microsoft/visualfsharp/blob/ee84eb77bcd62379d8178e3167a17d12d204de30/src/fsharp/vs/service.fs I see things like this:

GetEnvInteger "FCS_ProjectCacheSizeDefault" 3

Does that mean that we can override the value with environment variables?

I think at least it would be a way to tweak those settings if situation becomes dire, although with this PR this is not possible for that 200 setting.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smoothdeveloper No, that setting is the one used if none is provided explicitly at FSharpChecker creation. So this changes the setting from 3 to 200 (which means basically strongly holding all background checkers and associated resources for all projects - which intuitively feels sure to blow up memory usage with many scripts or projects - in F# each script counts as a project)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsyme I meant if we revert that parameter change in the PR, can we use environment variable to override it?

Also, longer term, would making stuff that project relies on (like the same assembly metadata, which is probably retrieved for many projects in a solution) shared across the board have a significant impact on memory used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsyme
Copy link
Contributor

dsyme commented Dec 29, 2016

What does memory/CPU consumption look like with this change?

@cartermp We very badly need proper methodology for evaluating the memory-performance impact of new VS features. Advice from the Roslyn team on how they achieve automated memory performance testing may be useful here.

@dsyme
Copy link
Contributor

dsyme commented Dec 29, 2016

@KevinRansom I feel we may need to slow down the rate of merging so we can discuss and assess things like #2124 (review) before integrating.

@cartermp
Copy link
Contributor

@Pilchie would you be able to address some of @dsyme's concerns above?

@vasily-kirichenko
Copy link
Contributor

From my (a couple of years I think) experience with that parameter I can say that it definitely does not help with memory consumption, but makes FCS unusable if it's set to a small number. If you set it to, say, 50 and try to check 60 projects, it will take it ages to finish (if ever). On the other hand, the compiler project can easily consume all the 2.5GB in minutes, so this setting should be something like 'number of lines of checked code', not even 'number of checked files', let alone projects.

@dsyme
Copy link
Contributor

dsyme commented Dec 30, 2016

@vasily-kirichenko Yeah, agreed. Or just an overall "maximum memory for F# project caching". I wish it was easier to measure how much those caches are consuming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

High memory consumption

8 participants