{"id":347,"date":"2014-10-16T14:20:59","date_gmt":"2014-10-16T14:20:59","guid":{"rendered":"https:\/\/aheaddata.com\/?p=347"},"modified":"2022-11-03T09:46:05","modified_gmt":"2022-11-03T09:46:05","slug":"compressio-en-una-connexio-jdbc","status":"publish","type":"post","link":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/","title":{"rendered":"Compresi\u00f3n en una conexi\u00f3n JDBC"},"content":{"rendered":"<img loading=\"lazy\" class=\"alignleft wp-image-348 size-thumbnail\" src=\"https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-150x150.png\" alt=\"base de dades\" width=\"150\" height=\"150\" srcset=\"https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-150x150.png 150w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-300x300.png 300w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-100x100.png 100w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-31x31.png 31w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-38x38.png 38w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-215x215.png 215w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-270x270.png 270w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1-365x365.png 365w, https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1.png 512w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><br \/>\nEsta semana hemos tenido una situaci\u00f3n un poco peculiar. Una aplicaci\u00f3n Java que conecta con una base de datos iba\u00a0lenta en ciertos momentos. No era un problema de CPU en el cliente ni en el servidor de base de datos, ni tampoco era un problema de disco ni de red, todo iba\u00a0como siempre.<\/p>\n<h2>El problema<\/h2>\n<p>Algunos de los listados de informaci\u00f3n que Java obten\u00eda de la base de datos v\u00eda JDBC eran grandes (del orden de MB) y la respuesta tardaba en llegar por falta de un mayor ancho de banda.<!--more--><\/p>\n<h2>Posibles soluciones<\/h2>\n<ol>\n<li>Reducir la informaci\u00f3n que la aplicaci\u00f3n recog\u00eda de la base de datos.Esto ten\u00eda un par de problemas:\n<ul>\n<li>Obligaba a\u00a0cambiar la programaci\u00f3n de la aplicaci\u00f3n, cosa que no dese\u00e1bamos.<\/li>\n<li>El client deb\u00eda\u00a0decidir cambios de funcionalidad en la aplicaci\u00f3n para que \u00e9sta no recibiese tanta informaci\u00f3n.<\/li>\n<\/ul>\n<\/li>\n<li>Comprimir la conexi\u00f3n JDBC, Intentando reducir el ancho\u00a0de banda necesario.<\/li>\n<\/ol>\n<h2>Soluci\u00f3n adoptada<\/h2>\n<p>Finalmente se ha optado por la soluci\u00f3n 2. Parace algo impensable porqu\u00e9 normalmente en\u00a0las empresas, que tienen el servidor en su red\u00a0local, no necesitan aplicar compresi\u00f3n,\u00a0pero el est\u00e0ndard JDBC lo permite.<\/p>\n<h2>\u00bfC\u00f3mo?<\/h2>\n<p>Tan f\u00e1cil como indicar-lo en el momento de\u00a0crear la conexi\u00f3n, formando\u00a0la URL de conexi\u00f3n de la siguiente forma:<\/p>\n<blockquote><p>connectionUrl = \u00abjdbc:mysql:\/\/\/?useCompresion=true\u00bb;<\/p><\/blockquote>\n<p>As\u00ed, hemos conseguido una compresi\u00f3n de m\u00e1s del 80%.<\/p>\n<h2>Atenci\u00f3n<\/h2>\n<p>Si el ancho\u00a0de banda no es para ti\u00a0un problema no deber\u00edas aplicar la compresi\u00f3n, porqu\u00e9 posiblemente comprimir y descomprimir sea m\u00e1s lento. De todas formas puedes hacer\u00a0la prueba, es f\u00e1cil.","protected":false},"excerpt":{"rendered":"<p>Disculpa, pero esta entrada est\u00e1 disponible s\u00f3lo en Catal\u00e1n.<\/p>\n","protected":false},"author":333999,"featured_media":348,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,34,36],"tags":[54,53,82,83,92,74,90,94,93,91,88,89,86,87,85,84],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica\" \/>\n<meta property=\"og:description\" content=\"Disculpa, pero esta entrada est\u00e1 disponible s\u00f3lo en Catal\u00e1n.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/\" \/>\n<meta property=\"og:site_name\" content=\"Ahead Data Inform\u00e1tica\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-16T14:20:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-03T09:46:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"web@aheaddata.com\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"web@aheaddata.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/aheaddata.com\/es\/#website\",\"url\":\"https:\/\/aheaddata.com\/es\/\",\"name\":\"Ahead Data Inform\u00e1tica\",\"description\":\"Programaci\u00f3n, dise\u00f1o web y mantenimiento inform\u00e1tico\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/aheaddata.com\/es\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/\",\"url\":\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/\",\"name\":\"Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica\",\"isPartOf\":{\"@id\":\"https:\/\/aheaddata.com\/es\/#website\"},\"datePublished\":\"2014-10-16T14:20:59+00:00\",\"dateModified\":\"2022-11-03T09:46:05+00:00\",\"author\":{\"@id\":\"https:\/\/aheaddata.com\/#\/schema\/person\/86e344da57003c643d2f1faaff7b54a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[[\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/\"]]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inici\",\"item\":\"https:\/\/aheaddata.com\/es\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Compressi\u00f3 en una connexi\u00f3 JDBC\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/aheaddata.com\/#\/schema\/person\/86e344da57003c643d2f1faaff7b54a0\",\"name\":\"web@aheaddata.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/aheaddata.com\/es\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6c685aadd1ebe248c8c9c5d003c88cf7?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6c685aadd1ebe248c8c9c5d003c88cf7?s=96&d=identicon&r=g\",\"caption\":\"web@aheaddata.com\"},\"url\":\"https:\/\/aheaddata.com\/es\/author\/webaheaddata-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/","og_locale":"es_ES","og_type":"article","og_title":"Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica","og_description":"Disculpa, pero esta entrada est\u00e1 disponible s\u00f3lo en Catal\u00e1n.","og_url":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/","og_site_name":"Ahead Data Inform\u00e1tica","article_published_time":"2014-10-16T14:20:59+00:00","article_modified_time":"2022-11-03T09:46:05+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/aheaddata.com\/wp-content\/uploads\/2014\/10\/photo1.png","type":"image\/png"}],"author":"web@aheaddata.com","twitter_card":"summary","twitter_misc":{"Escrito por":"web@aheaddata.com","Tiempo de lectura":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/aheaddata.com\/es\/#website","url":"https:\/\/aheaddata.com\/es\/","name":"Ahead Data Inform\u00e1tica","description":"Programaci\u00f3n, dise\u00f1o web y mantenimiento inform\u00e1tico","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/aheaddata.com\/es\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"es"},{"@type":"WebPage","@id":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/","url":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/","name":"Compresi\u00f3n en una conexi\u00f3n JDBC - Ahead Data Inform\u00e1tica","isPartOf":{"@id":"https:\/\/aheaddata.com\/es\/#website"},"datePublished":"2014-10-16T14:20:59+00:00","dateModified":"2022-11-03T09:46:05+00:00","author":{"@id":"https:\/\/aheaddata.com\/#\/schema\/person\/86e344da57003c643d2f1faaff7b54a0"},"breadcrumb":{"@id":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":[["https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/"]]}]},{"@type":"BreadcrumbList","@id":"https:\/\/aheaddata.com\/es\/2014\/10\/compressio-en-una-connexio-jdbc\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Inici","item":"https:\/\/aheaddata.com\/es\/"},{"@type":"ListItem","position":2,"name":"Compressi\u00f3 en una connexi\u00f3 JDBC"}]},{"@type":"Person","@id":"https:\/\/aheaddata.com\/#\/schema\/person\/86e344da57003c643d2f1faaff7b54a0","name":"web@aheaddata.com","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/aheaddata.com\/es\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6c685aadd1ebe248c8c9c5d003c88cf7?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6c685aadd1ebe248c8c9c5d003c88cf7?s=96&d=identicon&r=g","caption":"web@aheaddata.com"},"url":"https:\/\/aheaddata.com\/es\/author\/webaheaddata-com\/"}]}},"_links":{"self":[{"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/posts\/347"}],"collection":[{"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/users\/333999"}],"replies":[{"embeddable":true,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/comments?post=347"}],"version-history":[{"count":5,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/posts\/347\/revisions"}],"predecessor-version":[{"id":455,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/posts\/347\/revisions\/455"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/media\/348"}],"wp:attachment":[{"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/media?parent=347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/categories?post=347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aheaddata.com\/es\/wp-json\/wp\/v2\/tags?post=347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}