有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java性能调优:com。麦克亨格。v2。资源库。Basicresourcepool。waitAvailable()方法占用应用程序的大部分运行时间

我有一个并行插入数据库数据块的应用程序(从技术上讲,很多本机插入查询都是在EntityManager对象上执行的)

我现在正试图了解如何加速这些插入。在数据库主机和应用程序主机上没有任何显著的处理器负载和io等待时间,服务器之间几乎没有延迟。 在VisualJVM sampler中,我可以看到大约80%的应用程序运行时间是由com花费的。麦克亨格。v2。资源池。Basicresourcepool。方法

有人知道这个方法到底在做什么吗?我尝试在JPA的连接池相关属性中增加/减少连接池最大大小,但没有发现任何显著差异。 任何关于如何加快插入速度的建议都将不胜感激

请参阅下面为应用程序提供持久性的EntityManagerFactory bean的属性:

hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
hibernate.connection.username=
hibernate.connection.password=
hibernate.connection.driver_class=jpa.connection.driver_class
hibernate.connection.url=
hibernate.connection.dialect=org.hibernate.dialect.OracleDialect
hibernate.connection.autoReconnect=true
hibernate.c3p0.min_size=3
hibernate.c3p0.max_size=100 /* tried different values - not much difference  */
hibernate.c3p0.timeout=1800 
hibernate.c3p0.max_statements=15000 
hibernate.c3p0.acquire_increment=1
hibernate.c3p0.validate=false
hibernate.c3p0.format_sql=false
hibernate.c3p0.show_sql=false
hibernate.c3p0.idle_test_period=240
hibernate.c3p0.maxIdleTime=0

共 (1) 个答案

  1. # 1 楼答案

    尝试批处理插入查询。也就是说,为多个插入收集一定数量的数据,并将其作为单个插入查询运行