好.我有一个Spring MVC控制器方法如下:
public String getInformationByGID(@ModelAttribute("geoInfoParam") @Valid GeoInfoParam geoInfoParam, Model model ,BindingResult result)
Run Code Online (Sandbox Code Playgroud)
GeoInfoParam类定义有许多带@NotNull,@ Size带注释的验证的输入,我希望在提交表单时执行它(因为我有@Valid和ModelAttribute).但是发生了什么,当我点击提交时,页面显示400错误,并且没有在日志中显示任何其他信息.
我正在尝试将大数据小批量加载到 PostgreSQL 服务器中的一个表中(总共 4000 万行)(每个 csv 中有 6000 行)。我认为 HikariCP 非常适合此目的。
这是我使用 Java 8 (1.8.0_65)、Postgres JDBC 驱动程序 9.4.1211 和 HikariCP 2.4.3 从数据插入中获得的吞吐量。
4 分 42 秒内 6000 行。
我做错了什么以及如何提高插入速度?
关于我的设置再多说几句:
程序使用大线程池异步插入每一行来容纳请求,如下所示:
private static ExecutorService executorService = new ThreadPoolExecutor(5, 1000, 30L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(100000));
Run Code Online (Sandbox Code Playgroud)数据源配置为:
private DataSource getDataSource() {
if (datasource == null) {
LOG.info("Establishing dataSource");
HikariConfig config = new HikariConfig();
config.setJdbcUrl(url);
config.setUsername(userName);
config.setPassword(password);
config.setMaximumPoolSize(600);// M4.large 648 …Run Code Online (Sandbox Code Playgroud)