Skip to content

Commit

Permalink
Merge pull request cockroachdb#13462 from BramGruneir/min
Browse files Browse the repository at this point in the history
server, storage/engine: lower the minimum number of open files per store
  • Loading branch information
BramGruneir authored Feb 8, 2017
2 parents a691cd4 + aaf8706 commit 454a507
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 3 additions & 4 deletions pkg/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,16 @@ func GetTotalMemory() (int64, error) {
// setOpenFileLimit sets the soft limit for open file descriptors to the hard
// limit if needed. Returns an error if the hard limit is too low. Returns the
// value to set maxOpenFiles to for each store.
// Minimum - 256 per store, 256 saved for networking
// Minimum - 1700 per store, 256 saved for networking
// Constrained - 256 saved for networking, rest divided evenly per store
// Constrained (network only) - 5000 per store, rest saved for networking
// Recommended - 5000 per store, 5000 for network
// Constrained (network only) - 10000 per store, rest saved for networking
// Recommended - 10000 per store, 5000 for network
// Also, please note that current and max limits are commonly referred to as
// the soft and hard limits respectively.
func setOpenFileLimit(physicalStoreCount int) (int, error) {
minimumOpenFileLimit := uint64(physicalStoreCount*engine.MinimumMaxOpenFiles + minimumNetworkFileDescriptors)
networkConstrainedFileLimit := uint64(physicalStoreCount*engine.RecommendedMaxOpenFiles + minimumNetworkFileDescriptors)
recommendedOpenFileLimit := uint64(physicalStoreCount*engine.RecommendedMaxOpenFiles + recommendedNetworkFileDescriptors)
// TODO(bram): Test this out on windows.
var rLimit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
if log.V(1) {
Expand Down
7 changes: 5 additions & 2 deletions pkg/storage/engine/rocksdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ const (
// recommended number, than the default value is used.
RecommendedMaxOpenFiles = 10000
// MinimumMaxOpenFiles is The minimum value that rocksDB's max_open_files
// option can be set to.
MinimumMaxOpenFiles = 2000
// option can be set to. While this should be set as high as possible, the
// minimum total for a single store node must be under 2048 for Windows
// compatibility. See:
// https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/17310124-add-ability-to-change-max-number-of-open-files-for
MinimumMaxOpenFiles = 1700
)

func init() {
Expand Down

0 comments on commit 454a507

Please sign in to comment.