Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic native-image configuration #1318

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Args = --initialize-at-build-time=io.lettuce.core.metrics.DefaultCommandLatencyCollector
3 changes: 3 additions & 0 deletions src/main/resources/META-INF/native-image/proxy-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[
["io.lettuce.core.api.sync.RedisCommands","io.lettuce.core.cluster.api.sync.RedisClusterCommands"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need also the following types (going through all places where we create proxies):

  • AsyncNodeSelection
  • HasTargetConnection
  • NodeSelection
  • NodeSelectionAsyncCommands
  • NodeSelectionCommands
  • NodeSelectionPubSubAsyncCommands
  • NodeSelectionPubSubCommands
  • NodeSelectionPubSubReactiveCommands
  • PubSubAsyncNodeSelection
  • PubSubNodeSelection
  • PubSubReactiveNodeSelection
  • RedisAdvancedClusterCommands
  • RedisClusterAsyncCommands
  • RedisClusterCommands
  • RedisClusterPubSubCommands
  • RedisCommands
  • RedisPubSubAsyncCommands
  • RedisPubSubCommands
  • RedisSentinelCommands

]
Copy link
Collaborator

Choose a reason for hiding this comment

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

For dynamic command proxies we additionally need:

  ["java.lang.reflect.ParameterizedType","io.lettuce.core.dynamic.support.TypeWrapper$SerializableTypeProxy","java.io.Serializable", "java.lang.reflect.TypeVariable"],

233 changes: 233 additions & 0 deletions src/main/resources/META-INF/native-image/reflect-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
[
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields",
Copy link
Collaborator

Choose a reason for hiding this comment

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

These are netty-related bits. We should remove these and leave configuration up to netty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 feel free to open an issue there

"fields":[{"name":"producerLimit","allowUnsafeAccess" : true}]
},
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields",
"fields":[{"name":"consumerIndex","allowUnsafeAccess" : true}]
},
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields",
"fields":[{"name":"producerIndex", "allowUnsafeAccess" : true}]
},
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField",
"fields":[{"name":"consumerIndex", "allowUnsafeAccess" : true}]
},
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField",
"fields":[{"name":"producerIndex", "allowUnsafeAccess" : true}]
},
{
"name":"io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField",
"fields":[{"name":"producerLimit","allowUnsafeAccess" : true}]
},
{
"name":"java.nio.Buffer",
"fields":[{"name":"address", "allowUnsafeAccess":true}]
},
{
"name":"java.nio.DirectByteBuffer",
"fields":[{"name":"cleaner", "allowUnsafeAccess":true}],
"methods":[{"name":"<init>","parameterTypes":["long","int"] }]
},
{
"name":"io.netty.buffer.AbstractReferenceCountedByteBuf",
"fields":[{"name":"refCnt", "allowUnsafeAccess":true}]
},
{
"name": "io.lettuce.core.AbstractRedisAsyncCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.ChannelGroupListener",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.ConnectionEventTrigger",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.PlainChannelInitializer$1",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.RedisAsyncCommandsImpl",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.RedisClient",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.BaseRedisCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.RedisCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.RedisGeoCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisHLLCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.RedisHashCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.RedisKeyCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.lettuce.core.api.sync.RedisListCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisScriptingCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisServerCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisSetCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisSortedSetCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisStreamCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisStringCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.api.sync.RedisTransactionalCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},

{
"name":"io.lettuce.core.cluster.api.sync.RedisClusterCommands",
"allPublicMethods": true,
"allDeclaredConstructors":true
},

{
"name":"io.lettuce.core.protocol.CommandHandler",
Copy link
Collaborator

Choose a reason for hiding this comment

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

We also need:

  • PubSubCommandHandler
  • SslChannelInitializer
  • SslRedisHandshakeHandler (6.0)
  • RedisHandshakeHandler (6.0)

Not sure about CommandEncoder

"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.lettuce.core.protocol.ConnectionWatchdog",
"allPublicMethods": true,
"allDeclaredConstructors":true
},

{
"name":"io.lettuce.core.resource.ClientResources",
"allPublicMethods": true,
"allDeclaredConstructors":true
},

{
"name":"io.lettuce.core.resource.DefaultClientResources",
"allDeclaredFields" : true,
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.netty.buffer.AbstractByteBufAllocator",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Netty types should be managed by netty.

"allPublicMethods": true,
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"io.netty.buffer.PooledByteBufAllocator",
"allPublicMethods": true,
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"io.netty.channel.ChannelDuplexHandler",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.netty.channel.ChannelHandlerAdapter",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.ChannelInboundHandlerAdapter",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.ChannelInitializer",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.ChannelOutboundHandlerAdapter",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.DefaultChannelPipeline$HeadContext",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.DefaultChannelPipeline$TailContext",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.channel.socket.nio.NioSocketChannel",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name": "io.netty.handler.codec.MessageToByteEncoder",
"allPublicMethods": true,
"allDeclaredConstructors":true
},
{
"name":"io.netty.util.ReferenceCountUtil",
"allPublicMethods": true,
"allDeclaredConstructors":true
}
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Additional types (for latency tracking, since we do class presence checks)

  • org.HdrHistogram.Histogram
  • org.LatencyUtils.PauseDetector
  • rx.Completable
  • reactor.core.publisher.Mono
  • io.reactivex.Flowable
  • io.reactivex.rxjava3.core.Flowable