SFTP writing is too slow in akka streams

i am trying to write to an sftp location with SFTP as sink , and for an 1MB file to write from my application it is taking almost 10 minutes.

how can i improve this.

i tried using “maxUnconfirmedreads” to 64 . but, it didn’t improved my performance and i believe it is for reading from sftp

Below is my code snippet

class SftpUtility {

  implicit val system: ActorSystem = ActorSystem("SftpUtility")
  val streamName: String = system.settings.config.getString("stream.config.name")
  val sftpKeyPath: String = system.settings.config.getString(s"$streamName.sftpKeyFile")
  val userName: String = system.settings.config.getString(s"$streamName.userName")
  val hostName: String = system.settings.config.getString(s"$streamName.hostName")
  val credentials: FtpCredentials = FtpCredentials.create(userName, "")
  val identity: KeyFileSftpIdentity = SftpIdentity.createFileSftpIdentity(sftpKeyPath)
  val settings: SftpSettings = SftpSettings(InetAddress.getByName(hostName))
    .withPort(22)
    .withSftpIdentity(identity)
    .withStrictHostKeyChecking(false)
    .withCredentials(credentials)
  def getWritable[T](properties: Map[String, String]): Graph[SinkShape[T], NotUsed] = {
    val fileName = getFileName(properties)
    GraphDSL.create() { implicit builder =>
      val sftpSink: SinkShape[T] = builder.add(Flow[T].map(row => ByteString(row.toString)).to(Sftp.toPath(fileName, settings)))
      SinkShape(sftpSink.in)
    }
  }

  def getFileName(properties:Map[String,String]): String ={
    val fileName = properties("targetFileName")
    val fileFormat = properties("fileFormat")
    val filePath = properties("targetFilePath")
    s"$filePath$fileName.$fileFormat"
  }

}