Example #1
0
func FetchDesiredState(l logger.Logger, c *cli.Context) {
	conf := loadConfig(l, c)
	messageBus := connectToMessageBus(l, conf)
	store := connectToStore(l, conf)

	fetcher := desiredstatefetcher.New(conf,
		messageBus,
		store,
		httpclient.NewHttpClient(),
		timeprovider.NewTimeProvider(),
	)

	resultChan := make(chan desiredstatefetcher.DesiredStateFetcherResult, 1)
	fetcher.Fetch(resultChan)

	select {
	case result := <-resultChan:
		if result.Success {
			l.Info("Success", map[string]string{"Number of Desired Apps Fetched": strconv.Itoa(result.NumResults)})
			os.Exit(0)
		} else {
			l.Info(result.Message, map[string]string{"Error": result.Error.Error(), "Message": result.Message})
			os.Exit(1)
		}
	case <-time.After(600 * time.Second):
		l.Info("Timed out when fetching desired state", nil)
		os.Exit(1)
	}
}
func StartListeningForActual(l logger.Logger, c *cli.Context) {
	conf := loadConfig(l, c)
	messageBus := connectToMessageBus(l, conf)
	store := connectToStore(l, conf)

	listener := actualstatelistener.New(conf,
		messageBus,
		store,
		timeprovider.NewTimeProvider(),
		l)

	listener.Start()
	l.Info("Listening for Actual State", nil)
	select {}
}
	"github.com/cloudfoundry/hm9000/testhelpers/appfixture"

	"fmt"
)

var numberOfApps = []int{30, 100, 300, 1000, 3000, 10000}
var numberOfInstancesPerApp = 2

var justOnce = false
var _ = Describe("Benchmarking AWS MCAT ", func() {
	var store *storecassandra.StoreCassandra
	BeforeEach(func() {
		if !justOnce {
			conf, _ := config.DefaultConfig()
			var err error
			store, err = storecassandra.New([]string{"127.0.0.1:9042"}, gocql.One, conf, timeprovider.NewTimeProvider())
			Ω(err).ShouldNot(HaveOccured())
			justOnce = true
		}
	})

	for _, numApps := range numberOfApps {
		numApps := numApps
		iteration := 1
		Context(fmt.Sprintf("With %d apps", numApps), func() {
			Measure("Read/Write/Delete Performance", func(b Benchmarker) {
				fmt.Printf("%d apps iteration %d\n", numApps, iteration)
				iteration += 1
				heartbeat := models.Heartbeat{
					DeaGuid:            models.Guid(),
					InstanceHeartbeats: []models.InstanceHeartbeat{},