This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nb -v run driver=http yaml=http-docsapi-keyvalue tags=phase:schema stargate_host=my_stargate_host auth_token=$AUTH_TOKEN | |
description: | | |
This workload emulates a key-value data model and access patterns. | |
This should be identical to the cql variant except for: | |
- Schema creation with the Docs API, we don't use cql because the Docs API is opinionated about schema. | |
- There is no instrumentation with the http driver. | |
- There is no async mode with the http driver. | |
Note that stargate_port should reflect the port where the Docs API is exposed (defaults to 8082). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
repositories { | |
jcenter() | |
mavenCentral() | |
} | |
} | |
buildscript { | |
repositories { | |
maven { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java -jar build/libs/graphql-springboot-scope-0.0.1-SNAPSHOT.jar --spring.profiles.active=global | |
:: Spring Boot :: (v2.1.8.RELEASE) | |
2019-09-30 18:09:32.476 INFO 48278 --- [ main] graphqlscope.graphql.GraphqlApplication : Starting GraphqlApplication on winter with PID 48278 | |
2019-09-30 18:09:32.479 INFO 48278 --- [ main] graphqlscope.graphql.GraphqlApplication : The following profiles are active: global | |
2019-09-30 18:09:33.641 INFO 48278 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http) | |
2019-09-30 18:09:33.684 INFO 48278 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] | |
2019-09-30 18:09:33.684 INFO 48278 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24] | |
2019-09-30 18:09:33.795 INFO 48278 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cache: | |
expiryInSeconds: 15 | |
maxCacheSize: 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
@Scope(value = WebApplicationContext.SCOPE_APPLICATION, proxyMode = ScopedProxyMode.TARGET_CLASS) | |
@Profile("global") | |
public DataLoaderRegistry globalDataLoaderRegistry( | |
@Value("${cache.maxCacheSize}") long maxCacheSize, | |
@Value("${cache.expiryInSeconds}") long expiryInSeconds | |
) { | |
DataLoaderRegistry dataLoaderRegistry = new DataLoaderRegistry(); | |
CacheMap customCache = new CustomGuavaBasedCache(maxCacheSize, expiryInSeconds); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomGuavaBasedCache<U, V> implements CacheMap<U, V> { | |
private static final Logger LOG = LoggerFactory.getLogger(CustomGuavaBasedCache.class); | |
private Cache<U, V> cache; | |
public CustomGuavaBasedCache(long maxCacheSize, long expiryInSeconds) { | |
this.cache = CacheBuilder | |
.newBuilder() | |
.maximumSize(maxCacheSize) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java -jar build/libs/graphql-springboot-scope-0.0.1-SNAPSHOT.jar --spring.profiles.active=global | |
:: Spring Boot :: (v2.1.8.RELEASE) | |
2019-09-29 20:28:00.225 INFO 38395 --- [ main] graphqlscope.graphql.GraphqlApplication : Starting GraphqlApplication on winter with PID 38395 | |
2019-09-29 20:28:00.229 INFO 38395 --- [ main] graphqlscope.graphql.GraphqlApplication : The following profiles are active: global | |
2019-09-29 20:28:01.428 INFO 38395 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http) | |
2019-09-29 20:28:01.467 INFO 38395 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] | |
2019-09-29 20:28:01.467 INFO 38395 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.24] | |
2019-09-29 20:28:01.565 INFO 38395 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
@Internal | |
@Primary | |
@Profile("global") | |
public class GlobalScopedGraphQLInvocation implements GraphQLInvocation { | |
private final GraphQL graphQL; | |
@Autowired(required = false) | |
DataLoaderRegistry dataLoaderRegistry; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Bean | |
@Scope(value = WebApplicationContext.SCOPE_APPLICATION, proxyMode = ScopedProxyMode.TARGET_CLASS) | |
@Profile("global") | |
public DataLoaderRegistry globalDataLoaderRegistry() { | |
DataLoaderRegistry dataLoaderRegistry = new DataLoaderRegistry(); | |
DataLoader<String, CountryTO> countryLoader = DataLoader.newDataLoader(graphQLDataFetchers.countryBatchLoader()); | |
dataLoaderRegistry.register("countries", countryLoader); | |
return dataLoaderRegistry; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./gradlew clean build | |
... | |
$ java -jar build/libs/graphql-springboot-scope-0.0.1-SNAPSHOT.jar --spring.profiles.active=request | |
:: Spring Boot :: (v2.1.8.RELEASE) | |
2019-09-29 20:11:24.119 INFO 38190 --- [ main] graphqlscope.graphql.GraphqlApplication : Starting GraphqlApplication on winter with PID 38190 | |
2019-09-29 20:11:24.122 INFO 38190 --- [ main] graphqlscope.graphql.GraphqlApplication : The following profiles are active: request | |
2019-09-29 20:11:25.288 INFO 38190 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8081 (http) | |
2019-09-29 20:11:25.331 INFO 38190 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] |
NewerOlder